[TYPO3-dev] bug dbType for date before 01-01-1970

Philipp Schiffmann p.schiffmann at bitmotion.de
Thu Sep 25 09:59:40 CEST 2014


Hi Ismaël,

first things first: I've never worked with mysql type date in TYPO3 so I
can't answer the original question you asked. Sorry. However, here's
another solution:

however, I don't store timestamp in the database but mysql date (better
> idea for birthday, cause I know unix timestamp can't be below 01/01/1970).
>
"Unix time is a single signed integer number [...]" [
http://en.wikipedia.org/wiki/Unix_time#Encoding_time_as_a_number ]
So a unix timestamp can be negative and you can use it for birthdays. Try
for yourself if you don't believe me:

$d = new DateTime();
$d->setTimestamp(-100000);
echo $d->format('m:d:Y');

The real problem with unix timestamps is that they grow in memory as they
gain distance from 01.01.1970. That's where the 2038 problem originates. [
http://en.wikipedia.org/wiki/Year_2038_problem ]
PHP stores DateTime timestamps internally in a 64bit integer [
http://php.net/manual/en/intro.datetime.php ], so you won't have troubles
with people living up to 292 billion years before or after you.

TLDR: Use timestamps.

Best regards,
Philipp



More information about the TYPO3-dev mailing list