|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20113 time() does not work correctly !!
Submitted: 2002-10-26 20:53 UTC Modified: 2002-10-26 22:20 UTC
From: corinl at gmx dot de Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.2 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
20 - 8 = ?
Subscribe to this entry?

 [2002-10-26 20:53 UTC] corinl at gmx dot de
it seems that time() doens't work correctyl, either in mysql or php, but i thinks it's php. may be aynone can verify this ?

    // check timestamps...
    $t1 = time();
    $sql = $theApp->sql->select_row("NOW() as t, UNIX_TIMESTAMP(NOW()) as s"); 
    $t2 = $sql['s'];
    $sqlt = $sql['t'];
    error_log("php: $t1, mysql: $t2, dif: ".($t2-$t1).", php-time: ".date("H:i:s").", sql-time: ".$sqlt);

php: 1035683199, mysql: 1035679599, dif: -3600, php-time: 02:46:39, sql-time: 2002-10-27 02:46:39

as you can see, the date reported is the same but the timestamp exactly differs one hour. i think this is because of summer/winter time, but im not sure. so either mysql or php returns wrong timestamp !!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-26 22:20 UTC]
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 02:01:28 2024 UTC