ID: 41842 User updated by: mattsch at gmail dot com 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 understand that it would be octal with a leading zero if I was creating an integer but I'm sending it a string though so I'm not sure how that applies. What I am referencing is the ISO 8601 standard which does not allow years to be less than 4 digits. So years less than 100 must be padded with a zero and years less than 99 must be padded with two zeros, etc. http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetch&nodeid=4021199 Quoted from ISO 8601:2004(E): 3.6 Leading zeros If a time element in a defined representation has a defined length, then leading zeros shall be used as required. calendar year is, unless specified otherwise, represented by four digits. Calendar years are numbered in ascending order according to the Gregorian calendar by values in the range [0000] to [9999]. Values in the range [0000] through [1582] shall only be used by mutual agreement of the partners in information interchange. Calendar date Basic format: −00020412 Extended format: −0002-04-12 Explanation: Expanded; four digits to represent the year. The twelfth of April in the second year before the year [0000] Previous Comments: ------------------------------------------------------------------------ [2007-06-30 02:13:23] [EMAIL PROTECTED] Sure you can. But of course a leading 0 indicates an octal number, so 099 is not a valid number. ------------------------------------------------------------------------ [2007-06-29 17:22:43] mattsch at gmail dot com I have discovered that it is also unable to create years between 0000 and 0099. ------------------------------------------------------------------------ [2007-06-28 18:17:04] [EMAIL PROTECTED] 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