php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22436 Valid solution for working with < 1969 dates
Submitted: 2003-02-26 08:22 UTC Modified: 2005-08-13 21:30 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: ivo at ibuildings dot nl Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.3.0 OS: Redhat 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: ivo at ibuildings dot nl
New email:
PHP Version: OS:

 

 [2003-02-26 08:22 UTC] ivo at ibuildings dot nl
Hi,

working with dates before 1970 with mktime sometimes works, sometimes doesn't.

There are several bugs in the bug database describing this problem: bug #18802, bug #22163 and bug #20280.

All are answered with stuff like "behaviour of mktime before 1970 is undefined", "it's not a php bug because it's due to glibc" etc.

While all of these are most certainly true, it's not really a helpful answer to php users. PHP users just want to do stuff with dates. When working with birthdates, dates from before 1970 are quite common. Therefor, I request that the php date/time functions will be made such that they *work*, regardless of the operating system, the glibc version etc.

Would you please consider doing this?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-26 09:26 UTC] iliaa@php.net
Just a a note, PEAR has a date class capable of handling dates prior to 1969.
 [2003-02-28 02:13 UTC] ivo at ibuildings dot nl
There's a library (part of adodb) to work around the negative date problem on windows. It can be modified to perform the same functionality on linux, when mktime does not work as expected there. This lib can be found here:

http://php.weblogs.com/adodb_date_time_library

Perhaps this functionality can be made a standard in php? In other words, make mktime behave exactly like the adodb_mktime function from this library etc.?
 [2004-01-10 10:24 UTC] pajoye@php.net
Hello,

As a sidenote, I just commited pecl/date which support date ranges lower  than unix Epoc. Win32 snaps are available through http://snaps.php.net/win32/PECL_UNSTABLE/

hth

pierre
 [2005-08-13 21:30 UTC] nlopess@php.net
Fixed in PHP 5.1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 21:01:27 2024 UTC