Page 1 of 1

Time Difference

Posted: Fri Feb 18, 2005 10:17 pm
by cAEZAr
i would like to ask a code on how to get the time difference between time1 and time2..
eg.
time1 = 3:40 PM
time2 = 7:22 PM
===========
ttime = ?:?? PM

i am using a 12Hour format...
help me on how to get this.. :)

Posted: Fri Feb 18, 2005 10:22 pm
by feyd
convert the time values to seconds. strtotime() may help with this.

Posted: Fri Feb 18, 2005 10:29 pm
by cAEZAr
i forgot that function.. :D
yes its useful,

by the way is there any other way? :)

Posted: Fri Feb 18, 2005 10:52 pm
by anjanesh
MySQL 4.1.1
SELECT TIMEDIFF('07:22','03:40')
http://dev.mysql.com/doc/mysql/en/date- ... tions.html