Syntax
FROM_UNIXTIME(unix_timestamp)
FROM_UNIXTIME(unix_timestamp, format)
Purpose
The FROM_UNIXTIME() function returns values based on the following rules:
If you do not specify the
formatparameter, it returns aDATETIMEvalue without considering the time zone.If you specify the
formatparameter, it returns a date and time string in the specified format.
unix_timestamp is the number of seconds elapsed since 1970-01-01 00:00:00.
For more information about the supported format options, 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
