News for hackers. Stuff that matters.
Re:ISO-8601 date format reference not publicly available by Macha on Tuesday March 09, 2021 @01:20PM (#26401749)
Yeah, there's enough software that only understands ISO-8601 to be YYYY-MM-DDThh:mm:ss (with optional Z or +/-xx:xx for a offset datetime), that I wouldn't rely on anything more niche from the spec.

That does include the period definition format, which I know will disappoint some people.

Re:ISO-8601 date format reference not publicly available by Quekid5 on Tuesday March 09, 2021 @07:52PM (#26406492)
After learning some more about the practicalities of time/date throughout my career, it always seemed a bit odd to me to even support the +/- thing... but maybe I'm missing something. My reasoning is: If it's a timestamp (i.e. it's a point on the physical time line, relativity notwithstanding), Z should be fine and unambiguous. If it's a local date/time then you need the actual legal time zone (e.g. Europe/Berlin, or whatever.) since those can and have changed historically. Sure, you can encode that as an offset for any given instant if you're actually talking about "now" or the past, but that's a lossy encoding and you can't really talk about future events using an offset.
Re:ISO-8601 date format reference not publicly available by rntksi on Tuesday March 09, 2021 @08:48PM (#26406828)
My understanding is that it is because it changes historically that you'd rather want +/- (an absolute measure) rather than Continent/Location denonimation (a measure that is bound to change).

If you want to record a local timestamp historically (e.g. log that this event of the electric facility happened at this time in the history of the facility, at the location of the facility), you want to say exactly when it happened, in the local time of the place, notwithstanding political/societal changes to the timezone it is attached to.

Does this make sense? Talking about time always makes things confusing.

Re:ISO-8601 date format reference not publicly available by Quekid5 on Tuesday March 09, 2021 @09:17PM (#26406991)
Right, for explicitly recording a timestamp without having to refer to a historical time zone database it would seem to make a tiny bit of sense... but recording the actual time zone would work just as well for historical data and future times. I just have a hard time imagining a scenario where you really care about the offset... the timestamp itself is enough.

Maybe it's just historical baggage from not wanting to keep that historical record of time zones around for all eternity?

I dunno. It's a bit weird to me. It's a very indirect (precise) measure of something that doesn't seem like it would have much use over just recording the direct measure (TZ and/or just the UTC timestamp)

The more your learn about datetime the more confusing it gets, I suppose :). I guess it's good to know that it can get very confusing (and therefore to tread carefully) and to temper one's expectations of datetime libraries.

Re:ISO-8601 date format reference not publicly available by taylodl on Tuesday March 09, 2021 @02:41PM (#26403076)
> period definition format

You mean the milliseconds? You're correct that YMMV with regards to libraries, but a lot of them handle milliseconds as well.

Re:ISO-8601 date format reference not publicly available by Macha on Tuesday March 09, 2021 @03:02PM (#26403392)
No, I mean stuff like

2007-03-01T13:00:00Z/P1M

For something that occurs on the first of each month.

Re:ISO-8601 date format reference not publicly available by taylodl on Tuesday March 09, 2021 @03:09PM (#26403481)
Oh - combining a date/timestamp and a duration, such as xsd:duration (http://www.datypic.com/sc/xsd/t-xsd_duration.html). I've never seen them combined into a single string, though there have been times when that would have been really useful!
Re:ISO-8601 date format reference not publicly available by em500 on Tuesday March 09, 2021 @03:24PM (#26403673)
It looks like xsd:duration uses duration notation from ISO8601. The rules for combining them or designating recurring intervals are in ISO8601 section 4.4-4.5 [1]. Unfortunately, awareness and library support for ISO8601 interval notation are very sparse and most people/orgs just roll their own.

[1] https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_i...

Re:ISO-8601 date format reference not publicly available by phendrenad2 on Tuesday March 09, 2021 @07:37PM (#26406395)
Yeah I didn't know that ISO had recurring events in the spec. I guess most library authors don't either, and as GP said, they think the RFC covers it.