0

Hello.
I am trying to get the difference in time between two fields in the database. One is start_time and the other one is stop_time.
They are in "0000-00-00 00:00:00" format. I want to do this in php/mysql. I already got the times pulling from the database, just need the difference between them.
Anybody knows how to do this???

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Web_Student
0

If you're running mySQL 4.1.1 you can use the timediff function.

select TIMEDIFF (timestamp1 , timestamp2)

if you're running a mySQL version less than 4.1.1 you can use:

select UNIX_TIMESTAMP(timestamp1) - UNIX_TIMESTAMP(timestamp2)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.