Time Difference

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cAEZAr
Forum Newbie
Posts: 2
Joined: Fri Feb 18, 2005 9:23 pm
Location: Philippines

Time Difference

Post 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.. :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

convert the time values to seconds. strtotime() may help with this.
cAEZAr
Forum Newbie
Posts: 2
Joined: Fri Feb 18, 2005 9:23 pm
Location: Philippines

Post by cAEZAr »

i forgot that function.. :D
yes its useful,

by the way is there any other way? :)
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

MySQL 4.1.1
SELECT TIMEDIFF('07:22','03:40')
http://dev.mysql.com/doc/mysql/en/date- ... tions.html
Post Reply