Syntax
FROM_UNIXTIME(unix_timestamp)
FROM_UNIXTIME(unix_timestamp, format)
Purpose
FROM_UNIXTIME() returns a value based on the following rules:
If
formatis not specified, a value of theDATETIMEtype is returned, regardless of the time zone.If
formatis specified, a date and time string in the specified format is returned.
unix_timestamp refers to the UNIX timestamp, that is, the number of seconds from 1970-01-01 00:00:00.
For more information about the formats supported by format, see DATE_FORMAT.
Examples
obclient> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x');
+---------------------------------------------------------+
| FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x') |
+---------------------------------------------------------+
| 2018 5th May 08:41:26 2018 |
+---------------------------------------------------------+
1 row in set