[TYPO3-english] Converting DATE to INT

Jigal van Hemert jigal at xs4all.nl
Sat Nov 14 09:01:15 CET 2009


Hi Andi,

Andreas Becker wrote:
> Does anybody know a way to CONVERT the DATE to INT so that the typo3 value
> will be available again in the database for the extensions to be used.

Assuming that you already found that the MySQL DATE format has a much 
larger range than a UNIX timestamp (the INT you refer to) and that the 
dates are all in the range of a timestamp, you can easily convert them 
using a small query with the UNIX_TIMESTAMP() function.
UPDATE `table1` SET `intcolumn` = UNIX_TIMESTAMP(`datecolumn`);

[1] 
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp

Regards, Jigal.


More information about the TYPO3-english mailing list