Jump to content

Date input


DDV
 Share

Recommended Posts

I'm compiling a database with anniversaries and stuff. When I add a date, the date field doesn't accept dates before 01/01/1902. Is there a limit? What if I want to add dates 'bc' like the birth of Cicero, January 3, 106 BC?

Link to comment
Share on other sites

Hello DDV and welcome to the PW forums.

As far as I know, 1902 is the earliest date you can represent on any 32-bit unix-like system that uses "unix time" to represent dates. This is not a limitation with ProcessWire per-se but because the time data is stored in "unix time" which is an integer representing the number of seconds before (negative) or after (positive) the "unix epoch" which is 01-01-1970. This allows +/- 68 years around the epoch year, meaning the earliest year you can represent is 1902.

More information about this issue on Wikipedia (esp. the section on "Representing the number").

If you do not need to perform any manipulation of dates, you could just keep them as strings.

  • Like 1
Link to comment
Share on other sites

Use separate fields for d m and Y. Then u would be able to do finds more easy and have no limit. Not sure what else but there seems no other way. To calculate day of week Im not sure you could simply use php date functions to do that.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...