PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #10180 date arithmetic gives wrong result
Submitted:5 Apr 2001 5:44am UTC Modified: 5 Apr 2001 6:27am UTC
From:ray at rayho dot co dot uk Assigned to:
Status:Closed Category:Date/time related
Version:4.0.4pl1 OS:Windows 2000
View/Vote Developer Edit Submission

Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can not add a comment to this report as it is marked as closed. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Category:
Summary:
From: ray at rayho dot co dot uk
New email:
Version: OS:
New Comment:

[5 Apr 2001 5:44am 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");

?>
[5 Apr 2001 5:59am UTC] ab@php.net
daylight saving time started on 3.26.2001 so behaviour is correct

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC