Time difference in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sbettadpur
    New Member
    • Aug 2007
    • 121

    Time difference in PHP

    How to get the difference between two times considering AM and PM situation in PHP?
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    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

    Comment

    • charles07
      New Member
      • Dec 2011
      • 45

      #3
      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

      Comment

      • abhijeet1
        New Member
        • Jan 2012
        • 11

        #4
        Use this code in your timing code section.
        strtotime("+30 minutes")

        Comment

        Working...