UNIX_TIMESTAMP( ) can convert DATE values to seconds. : UNIX_TIMESTAMP « Date Time « SQL / MySQL






UNIX_TIMESTAMP( ) can convert DATE values to seconds.

     
mysql>
mysql> SELECT CURDATE( ), FROM_UNIXTIME(UNIX_TIMESTAMP(CURDATE( )));
+------------+-------------------------------------------+
| CURDATE( ) | FROM_UNIXTIME(UNIX_TIMESTAMP(CURDATE( ))) |
+------------+-------------------------------------------+
| 2011-10-03 | 2011-10-03 00:00:00                       |
+------------+-------------------------------------------+
1 row in set (0.00 sec)

mysql>

   
    
    
    
    
  








Related examples in the same category

1.UNIX_TIMESTAMP calculation
2.Converting Between Date-and-Time Values and Seconds
3.The number of seconds between dates that lie two weeks apart can be computed like this:
4.To convert the interval in seconds to other units, perform the appropriate arithmetic operation.