ID EN
Date and Time Functions

FROM_UNIXTIME(unix_timestamp[,format])

MySQL 8.4

Returns a representation of unix_timestamp as a datetime or character string value. The value returned is expressed using the session time zone. (Clients can set the session time zone as described in Section 7.1.15, “MySQL Server Time Zone Support”.) unix_timestamp is an internal timestamp value representing seconds since '1970-01-01 00:00:00' UTC, such as produced by the UNIX_TIMESTAMP() function.

Syntax

MYSQL
SELECT FROM_UNIXTIME(1447430881);
'2015-11-13 10:08:01'
SELECT FROM_UNIXTIME(1447430881) + 0;
20151113100801
SELECT FROM_UNIXTIME(1447430881,
                     '%Y %D %M %h:%i:%s %x');
'2015 13th November 10:08:01 2015'

Examples

Example

If format is omitted, this function returns a DATETIME value.

MYSQL
SELECT FROM_UNIXTIME(1447430881);
'2015-11-13 10:08:01'
SELECT FROM_UNIXTIME(1447430881) + 0;
20151113100801
SELECT FROM_UNIXTIME(1447430881,
                     '%Y %D %M %h:%i:%s %x');
'2015 13th November 10:08:01 2015'