Skip to main content
Version: V1.0.0

FROM_UNIXTIME

Declaration

FROM_UNIXTIME(unix_timestamp)
FROM_UNIXTIME(unix_timestamp, format)

Description

The return value of FROM_UNIXTIME() follows these rules:

  • If you do not specify the format parameter, it returns a DATETIME value that does not consider the time zone.

  • If you specify the format parameter, it returns a date and time string in the specified format.

unix_timestamp is the number of seconds since 1970-01-01 00:00:00.

For more information about the supported formats of format, see DATE_FORMAT.

Examples

SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x');
+---------------------------------------------------------+
| FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x') |
+---------------------------------------------------------+
| 2025 17th December 04:39:49 2025 |
+---------------------------------------------------------+
1 row in set (0.001 sec)