Computer >> Computer tutorials >  >> Programming >> MySQL

What kind of output is produced by UNIX_TIMESTAMP() function?


The function UNIX_TIMESTAMP produce the output in seconds i.e this function will convert the specified date or datetime value into a total number of seconds.

For example, the date ‘1970-05-15 05:04:30’ would be converted to total 11576070 seconds by UNIX_TIMESTAMP function.

mysql> select UNIX_TIMESTAMP('1970-05-15 05:04:30');
+---------------------------------------+
| UNIX_TIMESTAMP('1970-05-15 05:04:30') |
+---------------------------------------+
| 11576070                              |
+---------------------------------------+
1 row in set (0.09 sec)