Simon Schick
2013-09-07 12:47:00 UTC
Hi, all
Some days ago, I needed a date, formatted as date("c") ...
To be a bit more object-oriented, I worked with an instance of
DateTime. My first thought was: "As the documenting for date() defines
'c' as ISO8601, I can take the constant provided in the DateTime
object ... right?" ... and that was wrong.
Here's a code-example:
date("c");
// 2013-09-07T12:40:25+00:00
date(DateTime::ISO8601);
// 2013-09-07T12:40:25+0000
-> Take special care to the notation of the timezone.
The method date("c") actually formats a date, fitting to the format
defined in the constant DateTime::ATOM.
Are both formats (with and without colon) valid for ISO8601, or is the
documentation for the method date() wrong?
Bye,
Simon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Some days ago, I needed a date, formatted as date("c") ...
To be a bit more object-oriented, I worked with an instance of
DateTime. My first thought was: "As the documenting for date() defines
'c' as ISO8601, I can take the constant provided in the DateTime
object ... right?" ... and that was wrong.
Here's a code-example:
date("c");
// 2013-09-07T12:40:25+00:00
date(DateTime::ISO8601);
// 2013-09-07T12:40:25+0000
-> Take special care to the notation of the timezone.
The method date("c") actually formats a date, fitting to the format
defined in the constant DateTime::ATOM.
Are both formats (with and without colon) valid for ISO8601, or is the
documentation for the method date() wrong?
Bye,
Simon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php