Edit report at http://bugs.php.net/bug.php?id=51987&edit=1
ID: 51987
Comment by: jbondc at openmv dot com
Reported by: jbondc at openmv dot com
Summary: Datetime fails to parse an ISO 8601 ordinal date
(extended format)
Status: Open
Type: Feature/Change Request
Package: Date/time related
Operating System: FreeBSD
PHP Version: 5.2.13
Block user comment: N
Private report: N
New Comment:
This patch needs:
re2c -d -b -o ext/date/lib/parse_date.c ext/date/lib/parse_date.re
It also fixes tests that were failing in trunk.
I changed the behavior of timelib_parse_from_format() to always
initialized seconds, minutes, hours to 0 if they are not set.
Previous Comments:
------------------------------------------------------------------------
[2010-06-03 15:38:31] [email protected]
Forgive my initial hastiness, I overlooked the fact that doy should
always be 3-
digits in length. Sorry!!
------------------------------------------------------------------------
[2010-06-03 15:04:19] [email protected]
It's a feature request though, *but* before we add it we must be certain
that it doesn't conflict.
------------------------------------------------------------------------
[2010-06-03 14:55:14] jbondc at openmv dot com
Please leave this bug open, I will look at submitting a patch.
There is no reason not to support:
$d2 = new Datetime('1985-001');
$d2 = new Datetime('1985-002');
...
$d2 = new Datetime('1985-365');
AND
$d2 = new Datetime('1985-01');
$d2 = new Datetime('1985-12');
------------------------------------------------------------------------
[2010-06-03 14:36:21] [email protected]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
Currently only YYdoy and YY.doy are supported. Adding in YY-doy would
conflict
with existing support for YY-mm. See http://php.net/datetime.formats for
details
of what is currently available.
(Key: YY = four-digit year, doy = day of year, mm = month number.)
------------------------------------------------------------------------
[2010-06-03 13:55:51] jbondc at openmv dot com
Description:
------------
PHP 5.2.12 with Suhosin-Patch 0.9.7 (cli) (built: Dec 30 2009 15:41:26)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend
Technologies
Test script:
---------------
// Ordinal date â 12 April 1985
$d1 = new Datetime('1985102');
// OK
$d2 = new Datetime('1985-102');
// Exception: DateTime::__construct(): Failed to parse time string
(1985-102) at position 7 (2): Unexpected character
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51987&edit=1