MySQL Calculate Hours From Two Timestamps
SELECT (
UNIX_TIMESTAMP("2009-08-17 10:00") -
UNIX_TIMESTAMP("2009-08-17 09:00")
) AS seconds
>>> 3600
SELECT (
(UNIX_TIMESTAMP("2009-08-17 10:00") -
UNIX_TIMESTAMP("2009-08-17 09:00")) / 3600
) AS hours
>>> 1.0000
Comments
Leave a Reply