FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format) : FROM_UNIXTIME « Date Time Functions « MySQL Tutorial






Returns a unix_timestamp argument as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.

The value is expressed in the current time zone.

mysql>
mysql>
mysql> SELECT FROM_UNIXTIME(875996580);
+--------------------------+
| FROM_UNIXTIME(875996580) |
+--------------------------+
| 1997-10-04 13:23:00      |
+--------------------------+
1 row in set (0.00 sec)

mysql> SELECT FROM_UNIXTIME(875996580) + 0;
+------------------------------+
| FROM_UNIXTIME(875996580) + 0 |
+------------------------------+
|        19971004132300.000000 |
+------------------------------+
1 row in set (0.00 sec)

mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y %D %M %h:%i:%s %x');
+--------------------------------------------------------+
| FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y %D %M %h:%i:%s %x') |
+--------------------------------------------------------+
| 2007 22nd July 07:46:11 2007                           |
+--------------------------------------------------------+
1 row in set (0.00 sec)

mysql>








14.19.FROM_UNIXTIME
14.19.1.FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)
14.19.2.SELECT FROM_UNIXTIME(1111885200);
14.19.3.You can optionally give FROM_UNIXTIME function a format parameter