|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51950 DateTime does not handle decimal fractions of ISO 8601 format
Submitted: 2010-05-30 19:56 UTC Modified: 2016-08-07 14:51 UTC
Avg. Score:4.3 ± 0.8
Reproduced:119 of 120 (99.2%)
Same Version:24 (20.2%)
Same OS:18 (15.1%)
From: jmf at durcommefaire dot net Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5.3.2 OS: Ubuntu 10.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jmf at durcommefaire dot net
New email:
PHP Version: OS:


 [2010-05-30 19:56 UTC] jmf at durcommefaire dot net
DateTime does not handle decimal fractions of ISO 8601 format (cf.

This value has decimal fraction and is not recognized by DateTime :

$dateTime = DateTime::createFromFormat(
// bool(false)

The same value without the decimal fraction is recognized :

$dateTime = DateTime::createFromFormat(
// object(DateTime)#2 (3) { ["date"]=>  string(19) "2009-04-16 12:07:23" ["timezone_type"]=>  int(2) ["timezone"]=>  string(1) "Z" }


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-06 22:25 UTC]
-Assigned To: +Assigned To: deric
 [2010-06-06 22:25 UTC]
-Assigned To: deric +Assigned To: derick
 [2014-10-15 14:25 UTC] h dot kraal at tiw dot nl
This 4+ years old bug is still present in todays systems:
Ubuntu 10.04 / PHP 5.3.2-1ubuntu4.27
Ubuntu 12.04 / PHP 5.3.10-1ubuntu3.14
Ubuntu 14.04 / PHP 5.5.9-1ubuntu4.4
 [2014-11-12 23:48 UTC] dev at jonathanlidbeck dot com
This bug is present in PHP 5.5 for Windows.
 [2015-06-25 05:05 UTC] broncha at rajesharma dot com
Confirmed on Mac. PHP version 5.5.26
 [2015-12-01 09:28 UTC] seb at rootsandrain dot com
Still broken in PHP7:
 [2016-08-07 14:51 UTC]
-Status: Assigned +Status: Not a bug -Assigned To: derick +Assigned To: cmb
 [2016-08-07 14:51 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

DateTime::ISO8601 is defined to "Y-m-d\TH:i:sO"[1], so obviously
it doesn't accept microsecond fractions. If you expect these to be
given, use another format specifier, see <>.

If you want to accept different ISO-8601 date/time formats,
don't use date_create_from_format(), but rather date_create(),
see <>.

[1] <>
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Sep 23 08:01:25 2018 UTC