SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Jun 2008
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Subract two timestamp

    How to calculate the difference of two timestamps and display output in
    hrs, ..... minutes and .....Secs

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Just arithmetic.

    Unix timestamps are numbers of seconds

    The difference between two timestamps is also a number of seconds

    The number of hours is the number of seconds divided by (60 minutes * 60 seconds = 360)
    The number of minutes is the number of seconds, minus those hours, divided by 60
    The number of seconds is the number of seconds, minus those hours and minutes

    Round each value down to remove the fractional parts

  3. #3
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $diff=date("Y-m-d",strtotime(༽-01-2007') - strtotime(༽-01-2008'))

    try this out........

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gurukanthdesaik View Post
    $diff=date("Y-m-d",strtotime(༽-01-2007') - strtotime(༽-01-2008'))

    try this out........
    This is not the PHP forum, he can't use that code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •