php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10180 date arithmetic gives wrong result
Submitted: 2001-04-05 05:44 UTC Modified: 2001-04-05 06:27 UTC
From: ray at rayho dot co dot uk Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.4pl1 OS: Windows 2000
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ray at rayho dot co dot uk
New email:
PHP Version: OS:

 

 [2001-04-05 05:44 UTC] ray at rayho dot co dot uk
<?
    $birthdate = mktime(0, 0, 0, 1, 1, 2001);

    // should give 82 days old - correct
    $CurDate   = mktime(0,0,0,3,24,2001);
    printf("<BR>".date("z", $CurDate - $birthdate ) ." days old");

    // should give 83 days old - correct
    $CurDate   = mktime(0,0,0,3,25,2001);
    printf("<BR>".date("z", $CurDate - $birthdate ) ." days old");

    // should give 84 days old - instead gives 83
    $CurDate   = mktime(0,0,0,3,26,2001);
    printf("<BR>".date("z", $CurDate - $birthdate ) ." days old");

    // should give 85 days old - instead gives 84
    $CurDate   = mktime(0,0,0,3,27,2001);
    printf("<BR>".date("z", $CurDate - $birthdate ) ." days old");

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-05 05:59 UTC] ab@php.net
daylight saving time started on 3.26.2001 so behaviour is correct
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC