|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13590 unix timestamp arithmetic has anomally
Submitted: 2001-10-07 19:05 UTC Modified: 2001-10-07 21:23 UTC
From: spedding at met dot co dot nz Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.0.4pl1 OS: NT2000/(+Redhat)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: spedding at met dot co dot nz
New email:
PHP Version: OS:


 [2001-10-07 19:05 UTC] spedding at met dot co dot nz
creating a unix timestamp for a date with zero hours / minutes, and then adding time of day as seconds gives wrong result.

snippet from my code
        echo ("\n<!-- before hms ".strftime ("%b %d %Y %H:%M:%S", $dateAndTime)."-->\n");
        $dateAndTime += 7200;
        echo ("\n<!-- before DST ".strftime ("%b %d %Y %H:%M:%S", $dateAndTime)."-->\n");
example outputs

timestamp before arithmetic
<!-- before hms Oct 07 2001 00:00:00-->

after adding 7199 (ie 01:59)
<!-- before DST Oct 07 2001 01:59:59-->

after adding 7200 (ie 02:00)
<!-- before DST Oct 07 2001 03:00:00-->

only seems to happen for this transition between 1:59 and 2:00 , after that the 1 hour error is consistent.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-07 20:52 UTC] spedding at met dot co dot nz
daylight saving confusion!
 [2001-10-07 21:23 UTC]
Hehe ;) Beats us every then and now.


- Markus
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 04:01:27 2024 UTC