php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53764 date with timestamp = 0
Submitted: 2011-01-17 07:39 UTC Modified: 2011-01-17 08:31 UTC
From: daedal13 at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.17 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: daedal13 at gmail dot com
New email:
PHP Version: OS:

 

 [2011-01-17 07:39 UTC] daedal13 at gmail dot com
Description:
------------
Hello. I have catched strange behavior of php.
If 2nd argument of function date(or strftime) is 0, this function add some hours to result.
For example, in Moscow they add 3 hours (difference between GMT).
Is it true ?

Test script:
---------------
echo date('c', time()) . "\n";
echo date('c', time() - time()) . "\n";

Expected result:
----------------
2011-01-17T09:34:00+03:00
1970-01-01T00:00:00+03:00

Actual result:
--------------
2011-01-17T09:34:00+03:00
1970-01-01T03:00:00+03:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-17 08:31 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-01-17 08:31 UTC] aharvey@php.net
UNIX timestamp 0 is defined as 0:00:00 on January 1, 1970 in the UTC time zone. 
Since your time zone is three hours ahead of UTC, the same time occurred at 3 am 
in your local time zone.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 03 20:00:01 2026 UTC