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

 ID:               51987
 Updated by:       sala...@php.net
 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

 New Comment:

Forgive my initial hastiness, I overlooked the fact that doy should
always be 3-

digits in length. Sorry!!


Previous Comments:
------------------------------------------------------------------------
[2010-06-03 15:04:19] der...@php.net

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] sala...@php.net

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

Reply via email to