#21646 [NEW]: Strftime: negative timestamps

2003-01-14 Thread wolfandreas
From: [EMAIL PROTECTED]
Operating system: all
PHP version:  4.3.0
PHP Bug Type: Feature/Change Request
Bug description:  Strftime: negative timestamps

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 bug report at http://bugs.php.net/?id=21646&edit=1
-- 
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21646&r=trysnapshot
Fixed in CVS:   http://bugs.php.net/fix.php?id=21646&r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=21646&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21646&r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=21646&r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=21646&r=support
Expected behavior:  http://bugs.php.net/fix.php?id=21646&r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=21646&r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=21646&r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=21646&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21646&r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=21646&r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=21646&r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=21646&r=gnused




#21646 [Opn]: Strftime: negative timestamps

2003-01-14 Thread wolfandreas
 ID:   21646
 User updated by:  [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 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] [EMAIL PROTECTED]

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