How can I get the total number of seconds since '1970-01-01 00:00:01'
from a DateTime instance in MySQL?
views:
34answers:
3
+1
A:
You are looking for UNIX_TIMESTAMP()
.
See: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function%5Funix-timestamp
If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC.
Sven Lilienthal
2009-12-17 13:01:05
A:
SELECT DATE_FORMAT(value
, '%Y%m%d') AS date_ymd
FROM table_name
;
Colour Blend
2009-12-17 13:02:26