FROM_UNIXTIME()¶
Function Description¶
The FROM_UNIXTIME() function converts the internal UNIX timestamp value to a date and time value in normal format and displays it in YYYY-MM-DD HH:MM:SS or YYYMMDDHHMMSS format. It is inverse to the UNIX_TIMESTAMP () function.
Function Syntax¶
> FROM_UNIXTIME(unix_timestamp[,format])
Parameter definition¶
Parameters |
Description |
|---|---|
format |
Optional parameters. A format string representing the format of the return value. |
unix_timestamp |
Required parameters. Time stamp, a field in the database that stores time data. |
Example¶
mysql> SELECT FROM_UNIXTIME(1447430881);
+--------------------------------+
| from_unixtime(1447430881) |
+--------------------------------+
| 2015-11-14 00:08:01 |
+--------------------------------+
1 row in set (0.00 sec)
mysql> SELECT FROM_UNIXTIME(1447430881, '%Y %D %M %h:%i:%s %x');
+------------------------------------------------------------------+
| from_unixtime(1447430881, %Y %D %M %h:%i:%s %x) |
+------------------------------------------------------------------+
| 2015 14th November 12:08:01 2015 |
+------------------------------------------------------------------+
1 row in set (0.00 sec)
limit¶
Currently, the date format only supports the data formats of yyyy-mm-dd and yyyymmdd.