tapan — 2013-02-20T13:16:47-05:00 — #1
I am storing dates in mysql as unix timestamps. When I am doing select staments how do i get that unix timestamp converted to this format ?
Format is: yyyy-MM-dd HH:mm:ss
eruna — 2013-02-20T13:53:40-05:00 — #2
You would use DATE_FORMAT() ie: SELECT DATE_FORMAT(date,format) FROM tblname.
r937 — 2013-02-20T16:29:37-05:00 — #3
that's not enough -- you also have to convert the unix timestamp to a datetime value
you could nest FROM_UNIXTIME inside DATE_FORMAT, but luckily, FROM_UNIXTIME also accepts a format string, so you could just use it by itself
tapan — 2013-02-21T05:08:54-05:00 — #4
FROM_UNIXTIME did the trick.
system — 2014-10-07T23:45:32-04:00 — #5
This topic is now closed. New replies are no longer allowed.