| Bug #25598 | strtotime can't handle dates before 1970, and the documentation doesn't say it. | ||||
|---|---|---|---|---|---|
| Submitted: | 18 Sep 2003 5:57pm UTC | Modified: | 19 Nov 2003 8:01am UTC | ||
| From: | bens at benjamindsmith dot com | Assigned to: | |||
| Status: | Closed | Category: | Documentation problem | ||
| Version: | 4.3.2 | OS: | 2.4.x Linux, Windows | ||
| Votes: | 3 | Avg. Score: | 4.0 ± 0.8 | Reproduced: | 3 of 3 (100.0%) |
| Same Version: | 1 (33.3%) | Same OS: | 2 (66.7%) | ||
[13 Oct 2003 5:30am UTC] hholzgra@php.net
UNIX timestamps for dates before Jan 1st 1970 are undefined anyway some platforms treat negative timestamps as dates before 1970 while others just consider negative values as undefined ... so this is a 'won't fix' problem unless we come up with a portable PHP C-lib ;) AFAIR this *is* documented in other places in the manual?
[19 Nov 2003 8:01am UTC] didou@php.net
Fixed in CVS :) Hartmut, this was mentionned in strftime() but too specific to make an entity.

Description: ------------ No matter what I do, strtotime can't seem to handle dates prior to 1970. The answer returned is always -1. The manual doesn't indicate this fact. Reproduce code: --------------- echo phpversion(); echo "\n------------------\n"; $time1="1/1/1970"; $time2="31-dec-1969"; $time3="31-dec-1949"; echo strtotime($time1); echo "\n"; echo strtotime($time2); echo "\n"; echo strtotime($time3); echo "\n"; Expected result: ---------------- 4.3.2 ----------------- 28800 -{some integer other than 1} -{some bigger integer other than 1} Actual result: -------------- 4.3.2 ------------------ 28800 -1 -1