[TYPO3-50-general] Dates outside Unix Timestamp

Alban Cousinié ace at mind2machine.com
Fri Oct 19 11:55:05 CEST 2007


Hi all,

As I am developping an extension in Typo3 4, I am meeting an issue that has
already been reported several times and which could not be solved without
breaking compatibility. The development of Typo3 5.0 could thus be a unique
opportunity for solving this issue.

The issue is the following : 

In Typo3 tables, dates are stored as Unix timetamps.

As a consequence, any date outside the range 2-1-1970 to 19-1-2038 can't be
managed as Typo3 date fields. After 19-1-2038, a timestamp can no longer be
stored as an int number since a 32 bits overflow occurs and a 64 bit system
is required to handle bigger int numbers. 1970 is the start of the Unix
timestamp and it can't be handled, unless using negative timestamps.

In my case, I am developing a library extension where books from classical
authors may have been published in previous centuries. Same goes for those
author's birth and death dates.
I just can't deal with this kind of data using Typo3 date entries.

Maybe Typo3 5.0 would be an opportunity to figure a more robust date
handling system. Note there has been a suggestion of possibly using negative
timestamps in date fields
(http://www.nabble.com/negative-timestamps-and-PHP-t4594913.html ), but this
requires at least PHP 5.1 and wil not increase the time range much : this
will only allow us to get back to year 1902.

MySQL 5.0 allows storing dates from year 1000 to 9999. This is already much
better, but it may not be compatible with other databases date formats. 

A solution could be to store dates in several database columns, one for each
element : hours, minutes, seconds, day, month, year. Then we could pre /
post-process dates using PHP before/after storing/retreiving them.

What do you guys think ?

Regards

Alban Cousinié  





More information about the TYPO3-project-5_0-general mailing list