Skip to content

Conversation

@mariano
Copy link
Contributor

@mariano mariano commented Feb 20, 2015

This is an implementation of https://bugs.php.net/bug.php?id=69089

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.

…Time::RFC3339_EXTENDED to output datetime using the RFC3339 extended format (aka ISO8601 extended format)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have the PHP bug ID. Not sure why it says RFC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left over. Ill fix it
On Feb 20, 2015 11:08 AM, "Derick Rethans" notifications@github.com wrote:

In ext/date/tests/rfc-datetime_rfc3339_extended.phpt
#1103 (comment):

@@ -0,0 +1,17 @@
+--TEST--
+RFC: DateTime RFC3339 Extended

This should have the PHP bug ID. Not sure why it says RFC?


Reply to this email directly or view it on GitHub
https://github.com/php/php-src/pull/1103/files#r25070967.

@mariano
Copy link
Contributor Author

mariano commented Feb 20, 2015

@derickr just renamed the test to match the bug #

@php-pulls php-pulls merged commit d20da1d into php:master Feb 23, 2015
@mariano mariano deleted the rfc_datetime_rfc3339_extended branch February 24, 2015 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants