Reputation: 48440
I have a query that looks something like the following:
select timediff(time_end, time_begin) from tbl
time_end
and time_begin
are both of type datetime
Is there a trivial way I can convert the time there to return an integer (seconds)?
Upvotes: 8
Views: 18976
Reputation: 4392
Mysql TIME_TO_SEC is what you are looking for
SELECT TIME_TO_SEC(timediff(time_end, time_begin)) from tbl
Upvotes: 18