Hi,
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
Thanks.
Hi,
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
Thanks.
You would use DATE_FORMAT() ie: SELECT DATE_FORMAT(date,format) FROM tblname.
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
Hi,
FROM_UNIXTIME did the trick.
Thanks.