In MySQL, how can I convert a number of seconds into TIMESTAMP?


It is exactly reverse of UNIX_TIMESTAMP() and can be done with the help of FROM_UNIXTIME() function. For example, 11576070 seconds would be TIMESTAMP ‘1970-05-15 05:04:30’.

mysql> Select FROM_UNIXTIME(11576070);
+--------------------------------+
| FROM_UNIXTIME(11576070)        |
+--------------------------------+
|      1970-05-15 05:04:30       |
+--------------------------------+
1 row in set (0.00 sec)

Updated on: 28-Jan-2020

728 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements