php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19838 Oct 27, 2002
Submitted: 2002-10-09 16:07 UTC Modified: 2002-10-09 16:26 UTC
From: danielkim at rogers dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.0 OS: Windows 2000
Private report: No CVE-ID: None
 [2002-10-09 16:07 UTC] danielkim at rogers dot com
<?php
// Arbitrary dates to find out a day value in int
$dayX = strtotime('Jan 2 2002') - strtotime('Jan 1 2002');
$dayY = strtotime('April 28 1999') - strtotime('April 27 1999');
if ($dayX == $dayY){
    $aDay = $dayX; //$aDay = 86400;

    $date[0] = strtotime('Oct 20 2002');
        print date("M j 'y", $date[0]);
        print '<br>';
  
    for ($i=1; $i<10; $i++){
        $date[$i] = $date[$i-1] + $aDay;
        print date("M j 'y", $date[$i]);
        print '<br>';
    }
}
?>

The code prints

Oct 20 '02
Oct 21 '02
Oct 22 '02
Oct 23 '02
Oct 24 '02
Oct 25 '02
Oct 26 '02
Oct 27 '02
Oct 27 '02
Oct 28 '02

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-09 16:16 UTC] danielkim at rogers dot com
<?php
// Arbitrary dates to find out a day value in int
$dayX = strtotime('Jan 2 2002') - strtotime('Jan 1 2002');
$dayY = strtotime('April 28 1999') - strtotime('April 27 1999');
if ($dayX == $dayY){
    $aDay = $dayX; //$aDay = 86400;

    $date[0] = strtotime('Oct 24 2002');
        print date("M j 'y", $date[0]);
        print '<br>';
  
    for ($i=1; $i<10; $i++){
        $date[$i] = $date[$i-1] + $aDay;
        print date("M j 'y", $date[$i]);
        print '<br>';
    }
}
?>

The code prints

Oct 24 '02
Oct 25 '02
Oct 26 '02
Oct 27 '02
Oct 27 '02
Oct 28 '02
Oct 29 '02
Oct 30 '02
Oct 31 '02
Nov 1 '02
 [2002-10-09 16:26 UTC] msopacua@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html

$ php4/sapi/cli/php -f ./data.php 
86400
Start at: Oct 20 '02
Oct 21 '02 00:00:00 (1035151200 - 1)
Oct 22 '02 00:00:00 (1035237600 - 2)
Oct 23 '02 00:00:00 (1035324000 - 3)
Oct 24 '02 00:00:00 (1035410400 - 4)
Oct 25 '02 00:00:00 (1035496800 - 5)
Oct 26 '02 00:00:00 (1035583200 - 6)
Oct 27 '02 00:00:00 (1035669600 - 7)
Oct 27 '02 23:00:00 (1035756000 - 8)
Oct 28 '02 23:00:00 (1035842400 - 9)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 17:01:29 2024 UTC