Bug #66019 [NEW]: DateTime object does not support short ISO 8601 time format - YYYY-MM-DDTHH

From: Date: Sat, 02 Nov 2013 00:25:39 +0000
Subject: Bug #66019 [NEW]: DateTime object does not support short ISO 8601 time format - YYYY-MM-DDTHH
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182553@lists.php.net to get a copy of this message
From:             kaldari at gmail dot com
Operating system: MacOS X
PHP version:      5.5.5
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTime object does not support short ISO 8601 time format - YYYY-MM-DDTHH

Description:
------------
According to ISO 8601, the following is a valid date-time
representation:
2012-02-02T10
(representing 2 February 2012, 10:00)

However, PHP throws an error if the minutes are not specified.

Test script:
---------------
$tz = new DateTimeZone("Europe/Amsterdam");
$dateObject = new DateTime( '2012-02-02T10', $tz );
echo $dateObject->format( 'j F Y H:i' );

Expected result:
----------------
2 February 2012 10:00

Actual result:
--------------
Fatal error: Uncaught exception 'Exception' with message
'DateTime::__construct(): Failed to parse time string (2012-02-02T10) at
position 11 (1): Unexpected character'

-- 
Edit bug report at https://bugs.php.net/bug.php?id=66019&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66019&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66019&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66019&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66019&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66019&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66019&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66019&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66019&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66019&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66019&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66019&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66019&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66019&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66019&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66019&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66019&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66019&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66019&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66019&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66019&r=mysqlcfg



Thread (8 messages)

« previous php.bugs (#182553) next »