SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    966
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Want to make sure this date calcuation is correct

    Hai folks,

    my date : 2012/9/13

    i need to calculate the total number of milliseconds before 60days of above date (my date - 60 days).

    i have done the calcuation as follows and i just want to make sure its correct

    PHP Code:
    $mydate="2012/9/13"
    $expdt=strtotime($mydate) - 5184000000//5184000000 is the number of milliseconds in 60days. 
    Is the above correct?

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Just to ask, are you then going to convert that number back to a date?

  3. #3
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    966
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    Just to ask, are you then going to convert that number back to a date?
    hai cups

    i have another date will call 'your date' = '2012/10/13', usually this date is after (greater than) 'my date'.
    so i want to calcuate the number of days between 'my date' and 'your date'

    the whole code i am writing will be like this

    Code:
    $mydate="2012/9/13";
    $yourdate="2012/10/13";
    $mydate=strtotime($mydate) - 5184000000; //5184000000 is the number of milliseconds in 60days.
    $yourdate=strtotime($yourdate);
    $days=round(($yourdate-$mydate) / 86400000); //not tested yet


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
  •