By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

Time difference in PHP

100+
P: 121
How to get the difference between two times considering AM and PM situation in PHP?
Sep 6 '08 #1
Share this Question
Share on Google+
3 Replies


dlite922
Expert 100+
P: 1,584
what is the format of the time already? Do you have the time (hour, min) in variables or in a string?

If variables: see mktime()

if string: see strtotime()

...in the php manual.

Dan
Sep 6 '08 #2

P: 45
if it's mysql use timediff function

SELECT TIMEDIFF('2010-10-22 10:50:10','2010-10-22 10:27:10') AS timedifference

above query gives the answer 00:23:00
Jan 13 '12 #3

P: 11
Use this code in your timing code section.
strtotime("+30 minutes")
Jan 13 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.