# In MySQL, how can we represent the time value as an integer?

MySQLMySQLi Database

In MySQL, UNIX timestamp format is the way to represent time value as an integer. The integer value represented for the date value would be the number of seconds. The starting date for counting these number of seconds is ‘1970-01-01’.

mysql> SELECT UNIX_TIMESTAMP('2017-10-22 04:05:36')AS 'Total Number of Seconds';
+-------------------------+
| Total Number of Seconds |
+-------------------------+
|              1508625336 |
+-------------------------+
1 row in set (0.00 sec)

The UNIX_TIMESTAMP value is 10 digits long.

Published on 19-Feb-2018 11:22:51