Declaration
FROM_UNIXTIME(unix_timestamp)
FROM_UNIXTIME(unix_timestamp, format)
Description
The return value of FROM_UNIXTIME() follows these rules:
If the
formatparameter is not specified, aDATETIMEvalue is returned without considering the time zone.When the
formatparameter is specified, a date and time string in the specified format is returned.
unix_timestamp specifies the UNIX timestamp, which is the number of seconds elapsed since 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