#21646 [Opn]: Strftime: negative timestamps
| From: | wolfandreas at yahoo dot de | Date: | Wed, 15 Jan 2003 05:16:49 +0000 |
| Subject: | #21646 [Opn]: Strftime: negative timestamps | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30059@lists.php.net to get a copy of this message | ||
ID: 21646
User updated by: wolfandreas@yahoo.de
Reported By: wolfandreas@yahoo.de
Status: Open
-Bug Type: Feature/Change Request
+Bug Type: Date/time related
Operating System: all
PHP Version: 4.3.0
New Comment:
Situation:
The function strftime does return false for negative unix-timestamps.
Problem:
The functions mktime and strtotime return negative values for dates
before 1970-01-01 00:00 UT.
Many users try something like:
strftime($format,strtotime($date_before_1970))
and wonder why this does not work.
If the behavior for timestamps before second 0
(start of Jan 1., 1970 UT) is undefined why do all other time
functions
return negative values ?
The documentation for strftime does not say anything about negative
values for timestamps, too.
Solution:
Let strftime return values (Gregorian calendar) for negative
timestamps.
(Perhaps there should be a warning ?)
Previous Comments:
------------------------------------------------------------------------
[2003-01-14 23:13:46] wolfandreas@yahoo.de
Situation:
The function strftime does return false for negative unix-timestamps.
Problem:
The functions mktime and strtotime return negative values for dates
before 1970-01-01 00:00 UT.
Many users try something like:
strftime($format,strtotime($date_before_1970))
and wonder why this does not work.
If the behavior for timestamps before second 0
(start of Jan 1., 1970 UT) is undefined why do all other time functions
return negative values ?
The documentation for strftime does not say anything about negative
values for timestamps, too.
Solution:
Let strftime return values (Gregorian calendar) for negative
timestamps.
(Perhaps there should be a warning ?)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21646&edit=1