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???

Difference in what ? hours ?

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)

thanks unixmonkey! the TIMEDIFF helped

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.