Reputation: 69
I am trying to convert time to seconds in mysql.
IN_datetime OUT_datetime Duration
2013-09-14 17:58:50 2013-09-14 18:02:12 = 202
select time_to_sec(out_datetime - in_datetime ) from customer_1.reconcile
My output comes as 3280 instead of 202.
Upvotes: 2
Views: 409
Reputation: 1129
Try use this code:
SELECT TIMESTAMPDIFF(SECOND,'2013-09-14 17:58:50','2013-09-14 18:02:12') from test
Upvotes: 3