php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40645 strtotime don't work with negative timestamps
Submitted: 2007-02-26 17:55 UTC Modified: 2007-02-27 14:42 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: simone at ivg dot it Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.4.5 OS: Linux 2.6
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: simone at ivg dot it
New email:
PHP Version: OS:

 

 [2007-02-26 17:55 UTC] simone at ivg dot it
Description:
------------
The strtotime() function returns -1 if the date is prior to 1970-01-01.
Instead, date function works properly with negative timestamps.


Reproduce code:
---------------
strtotime("1951-12-22") returns -1
date("d/m/Y",-578944001) returns 28/08/1951



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-26 18:01 UTC] derick@php.net
This works fine for me with PHP 4.4.6RC2-dev:

<?php
echo strtotime("1951-12-22"), "\n";
?>

-568947600

 [2007-02-27 14:27 UTC] simone at ivg dot it
This isn't a PHP bug, but a GNU libc issue.
Here I've found a C code to test if my libc has the problem: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=196177

Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 23:01:33 2025 UTC