Req #69089 [Com]: Add support for RFC3339 extended to DateTime::format

From: Date: Wed, 04 Mar 2015 20:00:06 +0000
Subject: Req #69089 [Com]: Add support for RFC3339 extended to DateTime::format
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191161@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69089&edit=1

 ID:                 69089
 Comment by:         ppaisndud at gmail dot com
 Reported by:        mariano at cricava dot com
 Summary:            Add support for RFC3339 extended to DateTime::format
 Status:             Open
 Type:               Feature/Change Request
 Package:            Date/time related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Think the merge has already been done and can be closed


Previous Comments:
------------------------------------------------------------------------
[2015-02-20 12:34:14] mariano at cricava dot com

Description:
------------
Currently there's no built in format for outputting DateTime using RFC 3339 extended, which is
used in several APIs. An output using such format would look like:

2009-09-28T09:45:31.918-03:00

While PHP does have built in support for fraction of seconds in DateTime (provided the DateTime was
constructed with it) through its %u format modifier, this modifier cannot be used for RFC 3339
extended as it is a 6 digit version of the fraction. Instead, a new format modifier is needed
(proposed %v, because of its proximity with %u) to output the 3-digit version of the fraction. To
see the difference, for the fraction 918312 here's what would be output by both modifiers:

%u: 918312
%v: 918

A new constant should be added to DateTime (such as RFC3339_EXTENDED) that would output strings in
the RFC 3339 extended format, using this new %v modifier.

A pull request with relevant tests lives here:

https://github.com/php/php-src/pull/1103



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69089&edit=1


Thread (6 messages)

« previous php.bugs (#191161) next »