From: nick on
Ok, this is a bit off-topic for cljs but I was hoping someone here
might know the answer.

After reading this:

http://www.w3.org/TR/NOTE-datetime

"TZD = time zone designator (Z or +hh:mm or -hh:mm)"
"1994-11-05T08:15:30-05:00"

I'd say that ISO 8601 formatted dates should have a colon between the
hours and minutes in the time zone designator, right?

It looks like PHP got this wrong:

http://www.php.net/manual/en/class.datetime.php

ISO-8601 (example: 2005-08-15T15:52:01+0000)
const string DateTime::ISO8601 = Y-m-d\TH:i:sO ;
O Difference to Greenwich time (GMT) in hours Example: +0200

What's going on here? Did PHP get this wrong? If so, I wonder how I
should proceed with a PHP date formatting clone in javascript... keep
the incorrect behavior from PHP, or follow the standard? What do you
guys think?
From: Sean Kinsey on
On Apr 21, 6:28 am, nick <nick...(a)fastmail.fm> wrote:
> Ok, this is a bit off-topic for cljs but I was hoping someone here
> might know the answer.
>
> After reading this:
>
> http://www.w3.org/TR/NOTE-datetime
>
>   "TZD  = time zone designator (Z or +hh:mm or -hh:mm)"
>   "1994-11-05T08:15:30-05:00"
>
> I'd say that ISO 8601 formatted dates should have a colon between the
> hours and minutes in the time zone designator, right?

Both are valid.
From <http://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators>
> <time>Z
> <time>±hh:mm or <time>±hhmm
> <time>±hh

From: Adam Harvey on
On Tue, 20 Apr 2010 21:28:30 -0700, nick wrote:
> Ok, this is a bit off-topic for cljs but I was hoping someone here might
> know the answer.

FWIW, comp.lang.php may have been a better destination, since it's really
a question about the quirks of a particular PHP function.

> It looks like PHP got this wrong:
>
> http://www.php.net/manual/en/class.datetime.php
>
> ISO-8601 (example: 2005-08-15T15:52:01+0000) const string
> DateTime::ISO8601 = Y-m-d\TH:i:sO ; O Difference to Greenwich time
> (GMT) in hours Example: +0200
>
> What's going on here? Did PHP get this wrong? If so, I wonder how I
> should proceed with a PHP date formatting clone in javascript... keep
> the incorrect behavior from PHP, or follow the standard? What do you
> guys think?

Sean has already noted that ISO 8601 time zone designators are valid both
with and without the colons. PHP's date function also provides the P
format specifier which explicitly includes the colon in the time zone.

Without being absolutely sure, I'd suspect that the reason for O behaving
that way in the first place would be because date() would have been
developed initially to target RFC 822 compliant dates (as used
extensively in HTTP), which don't include a colon in the time zone
designator.

At any rate, if your goal is to intentionally replicate PHP's date
formatting functionality, you're probably best off sticking to how PHP
actually does it, warts and all -- anything else will likely lead to more
confusion.

Adam
From: nick on
On Apr 21, 4:43 am, Adam Harvey <use...(a)adamharvey.name> wrote:

> FWIW, comp.lang.php may have been a better destination, since it's really
> a question about the quirks of a particular PHP function.

Ideally yes, but every time I look at that NG I shudder at the thought
of posting there...

> Sean has already noted that ISO 8601 time zone designators are valid both
> with and without the colons.

This is what I needed to know. Luckily it makes for an easy solution
-- Thanks, both of you :)

> [...]
> At any rate, if your goal is to intentionally replicate PHP's date
> formatting functionality, you're probably best off sticking to how PHP
> actually does it, warts and all -- anything else will likely lead to more
> confusion.

I think you're right. Thanks for the advice!

-- Nick
From: Thomas 'PointedEars' Lahn on
Stefan Weiss wrote:

> By the way, there's a project which is trying to port all PHP functions
> to JS, for some reason. I didn't look at their code, but you may get
> some inspirations from their implementation of the date() function:
>
> http://phpjs.org/functions/index

Like how NOT to do it? It looks like the expected result of a million code
monkeys educated probably by w3schools.com, adding to PPK's misconceptions,
starting with undeclared `that = this' when `that' is not ever used, and
substr() calls.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee