Why is November 16 showing up twice??? Any idea?

Discussion in 'PHP' started by girog, Dec 31, 2011.

  1. #1
    CODE:
    $mydate = strtotime("2011-11-04"); // or: $mydate = mktime(0,0,0,"11","04","2011");
    for ($i = 0; $i <= 5; $i++) {
    echo "<br>" . $mydate . " = " . date("Y-m-d",$mydate);
    $mydate = $mydate + 24*60*60; // 1-day = 86400 sec.
    }

    RESULTS:
    1320382800 = 2011-11-04
    1320469200 = 2011-11-05
    1320555600 = 2011-11-06
    1320642000 = 2011-11-06
    1320728400 = 2011-11-07
    1320814800 = 2011-11-08
     
    Last edited: Dec 31, 2011
    girog, Dec 31, 2011 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    It should work, you are probably using an old PHP version?

    Try doing:
    echo "<br>" . $mydate . " = " . date("Y-m-d",$mydate + 43200);

    and see if that makes a difference.
     
    ThePHPMaster, Dec 31, 2011 IP
  3. girog

    girog Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OK, sorry. I figured it out.
    That was the end of "daylight saving time", so it shows Sunday at 00:00:00 and then again Sunday at 23:00:00.
     
    girog, Dec 31, 2011 IP
  4. girog

    girog Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Now that I see your answer, it would have fixed the problem. Thanks.
     
    girog, Dec 31, 2011 IP