NYCPHP Meetup

NYPHP.org

[nycphp-talk] Selecting unix timestamp from MySQL (3.x) datetimefield

Hans Zaunere hans at nyphp.com
Thu Aug 26 23:23:05 EDT 2004


> > I wish this were a DATE_FORMAT option...
> >
> > How do I turn a MySQL DATETIME field (0000-00-00 00:00) into a Unix
> > timestamp?
> >
> > Strtotime() choked.
> 
> a MySQL function:
> 
> UNIX_TIMESTAMP('0000-00-00 blah...')

That will do it, but also keep in mind the potential for date overflow,
since a UNIX timestamp has a smaller range than a DATETIME column.

UNIX_TIMESTAMP('1935-05-29')

for example

H



More information about the talk mailing list