#41842 [Asn]: Cannot create years < 0100 & negative years with date_create or new DateTime

From: Date: Fri, 29 Jun 2007 17:22:43 +0000
Subject: #41842 [Asn]: Cannot create years < 0100 & negative years with date_create or new DateTime
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114464@lists.php.net to get a copy of this message
 ID:               41842
 User updated by:  mattsch at gmail dot com
-Summary:          Cannot create negative years with date_create or new
                   DateTime
 Reported By:      mattsch at gmail dot com
 Status:           Assigned
 Bug Type:         Feature/Change Request
 Operating System: Gentoo Linux 2007.0
 PHP Version:      5.2.3
 Assigned To:      derick
 New Comment:

I have discovered that it is also unable to create years between 0000
and 0099.


Previous Comments:
------------------------------------------------------------------------

[2007-06-28 18:17:04] derick@php.net

The current code was not meant to do this, so it's not a real "bug" -
however, I'll check whether we can support this without breaking
something else.

------------------------------------------------------------------------

[2007-06-28 16:36:44] mattsch at gmail dot com

Description:
------------
When attempting to create a new date with a negative year and display
that date, the format function returns today's date with the timezone
offset modified and set to what the negative year should be.

Reproduce code:
---------------
<?
$date = new DateTime('-2007-06-28');
echo $date->format(DATE_ISO8601);
?>

Expected result:
----------------
Output:

-2007-06-28T11:31:19-0500

Actual result:
--------------
Outputs:

2007-06-28T11:31:19-2007


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41842&edit=1


Thread (6 messages)

« previous php.bugs (#114464) next »