Page 1 of 1

How Do I convert from a Time() to a DATE as YYYY-m-d h:i:s

Posted: Tue Feb 27, 2007 10:01 am
by beckwiga
I'm using phpBB. The user_regdate is stored as time(), I think in GMT?

ex: 11691162602

I'm trying to convert back from this to a date that I can use in a normal DATETIME field, YYYY-m-d h:i:s.

ex: 2007-02-27 xx:xx:xx or whatever it is.

Any advice appreciated.

Posted: Tue Feb 27, 2007 10:05 am
by feyd
If memory serves, the time stamp is the server's native. If that's GMT, then it's GMT. If that's PST, then it's PST.

The MySQL function FROM_UNIXTIME() will convert it to a date-time formatted string.

Posted: Tue Feb 27, 2007 10:11 am
by beckwiga
Yup, that works. That's exactly what I needed, thanks.