This is the killer for me. Most people promote ISO 8601 as a “definitive” date structure, when it actually supports a lot of different formats. What they actually want is usually RFC 3339.
2023-12.12T21:18-05 for time zone as central. The UTC time zone code at the end just tells you where the time is taken from. Usually Z is used since, well, it’s “universal,” but having a +13 or -06 or whatever else brings context, and allows computers to synchronize the string of text into a comparable time for event logs and such.
I’d rather have an explicit time zone any time a datetime is being passed around code as a string. Communicating it to a human is relatively safe since even if there’s a mistake, it’s directly visible. Before that last step, incorrect time zone parsing or implicit time zone assumptions in code that was written by “who knows” in the year “who knows” can be really annoying.
Thanks for the link. Reading it gave me a headache. Not because of the proposal, but because of the very clear explanation it includes of just how annoying time zones are. I never even thought about the fact that a time relative to a UTC timestamp isn’t uniquely associated with another UTC timestamp because the local UTC offset can change. It’s obvious when you say it, but now I’m wondering if I have more time zone bugs somewhere.
It only just hit me a month or two ago just what a timezone, as described by IANA, actually is.
I’m from the eastern half of the US state of North Dakota. We run on what we’d collloquially call “central time”, often abbreviated CST. That’s UTC-6:00 in winter and UTC-5:00 in summer (technically CDT, but whatever).
Long ago I had it passed down to me from on high that the IANA timezone indicator I should use for my local time is America/Chicago. Ok. Easy enough. Why Chicago, though? I long guessed because it happens to be one of the largest localities in the CST block? That is in fact the answer if you read the rationale of the tz database, but I did not know this at the time.
What threw me off, though, is that there are other localities that seemingly map to the same time zone block. Like America/Mexico_City, or America/Indianapolis. What’s up with those? When I set my computer system clock to them, they behave just like America/Chicago does. Why are these here? And why these cities, specifically?
Then, imagine the loop I was thrown for when I discovered three timezone definitions exclusive to North Dakota. Those being America/North_Dakota/Beulah, ../../Center, and ../../New_Salem. What the fuck…?? These are literal nowhere towns. Midwest America is the middle of nowhere. North Dakota is the middle of nowhere within the Midwest. And these three towns are the middle of nowhere to the rest of us in North Dakota. What is going on? Why are there three tiny timezones in the middle of nowhere in the middle of nowhere in the middle of nowhere? And they’re all right next to each other!
Then, it clicked. What do these three places have in common? These towns all used to be in the next timezone over (“Mountain Time”, MST), but later decided to jump over to CST.
There’s a humorous story for why this happened. Supposedly, drinkers in the capital city, Bismarck, would stay to bar close. Then, they’d all hop in their cars and drunk drive to the sister city across the river, Mandan, for an extra hour of fun, causing untold chaos in the process. The jump was allegedly to curb this. Sadly, that story apocryphal. In reality, it was just because it was economically favorable to be time-aligned with the state capital city. But I digress…
If you were, say, looking over historic records of events recorded in both Bismarck and Beulah, where records are always taken simultaneously, and your data happened to span back before this switchover, there would be an inexplicable point in time where after it the timestamps would match, but before it, they’d be offset. So, to encode that, Beulah gets its own unique timezone all to itself that indicates this historical switchover exists.
It also explains why there are three tiny timezones all right next to one another. Three counties participated in this switchover, and to make it happen, each one had to individually pass laws to enact it. These laws all took effect on slightly different dates. Thus, if we wish to capture the nuanced time shifts in all three counties, each county needs its own bespoke timezone.
IANA timezones aren’t just representations of all the time zones that currently exist. They are representations of every unique permutation of historic clock changes for every place on Earth. That’s fucking nuts! Knowing that, I went from being shocked that there are so many timezones to being shocked that the list of timezones is as short as it is!
A single separator is better than a choice of separators to mean the same thing.
A space is not as apparent in a large log of data as a capital T
Human language is not as strict as a programming language. There is a reason you see people still using “alot” and “a lot”. That just proves it’s easy to overlook and commonly happens.
The difference:
2023-12-12T21:18Z is ISO 8601 format
2023-12-12 21:18 is RFC 3339 Format
A small change
ISO 8601 also allows for some weird shit. Like
2023-W01-1
which actually means2022-12-31
. There’s a lot of cruft in that standard.This is the killer for me. Most people promote ISO 8601 as a “definitive” date structure, when it actually supports a lot of different formats. What they actually want is usually RFC 3339.
Doesn’t the ISO also includes time periods? Because if it does, those are amazing.
Without any explanation, you should be able to decypher these periods just by looking at them:
Hmm I don’t get the T there tbh
It makes the difference between M meaning month or M meaning minute. Small differences.
So it’s redundant in P1DT4H? Or is it a mandatory separator between ymd and hms?
It’s mandatory, which also makes it nice and predictable.
Week numbers are convenient for projects in which key delivery dates are often expressed in his many weeks out they are.
wtf what is that gross
That Z is doing a lot of work.
Z indicates UTC. Alternatively,
2023-12.12T21:18-05 for time zone as central. The UTC time zone code at the end just tells you where the time is taken from. Usually Z is used since, well, it’s “universal,” but having a +13 or -06 or whatever else brings context, and allows computers to synchronize the string of text into a comparable time for event logs and such.
Yes. The RFC is missing something that explicitly indicates the time zone. The Z is a great unambiguous way of saying “yes, this is UTC.”
IMO, ISO 8601 is better for computers, people working with multiple time zones, or critical logging.
RFC 3339 is better used colloquially, while still remaining unambiguous for the use cases that most people use dates and times in.
I’d rather have an explicit time zone any time a datetime is being passed around code as a string. Communicating it to a human is relatively safe since even if there’s a mistake, it’s directly visible. Before that last step, incorrect time zone parsing or implicit time zone assumptions in code that was written by “who knows” in the year “who knows” can be really annoying.
I couldn’t agree more!
There’s a new RFC in the pipeline that will address this.
It’s already been approved, just needs to slooowly crawl its way theough the final publication queue.
Thanks for the link. Reading it gave me a headache. Not because of the proposal, but because of the very clear explanation it includes of just how annoying time zones are. I never even thought about the fact that a time relative to a UTC timestamp isn’t uniquely associated with another UTC timestamp because the local UTC offset can change. It’s obvious when you say it, but now I’m wondering if I have more time zone bugs somewhere.
It only just hit me a month or two ago just what a timezone, as described by IANA, actually is.
I’m from the eastern half of the US state of North Dakota. We run on what we’d collloquially call “central time”, often abbreviated CST. That’s UTC-6:00 in winter and UTC-5:00 in summer (technically CDT, but whatever).
Long ago I had it passed down to me from on high that the IANA timezone indicator I should use for my local time is
America/Chicago
. Ok. Easy enough. Why Chicago, though? I long guessed because it happens to be one of the largest localities in the CST block? That is in fact the answer if you read the rationale of the tz database, but I did not know this at the time.What threw me off, though, is that there are other localities that seemingly map to the same time zone block. Like
America/Mexico_City
, orAmerica/Indianapolis
. What’s up with those? When I set my computer system clock to them, they behave just likeAmerica/Chicago
does. Why are these here? And why these cities, specifically?Then, imagine the loop I was thrown for when I discovered three timezone definitions exclusive to North Dakota. Those being
America/North_Dakota/Beulah
,../../Center
, and../../New_Salem
. What the fuck…?? These are literal nowhere towns. Midwest America is the middle of nowhere. North Dakota is the middle of nowhere within the Midwest. And these three towns are the middle of nowhere to the rest of us in North Dakota. What is going on? Why are there three tiny timezones in the middle of nowhere in the middle of nowhere in the middle of nowhere? And they’re all right next to each other!Then, it clicked. What do these three places have in common? These towns all used to be in the next timezone over (“Mountain Time”, MST), but later decided to jump over to CST.
There’s a humorous story for why this happened. Supposedly, drinkers in the capital city, Bismarck, would stay to bar close. Then, they’d all hop in their cars and drunk drive to the sister city across the river, Mandan, for an extra hour of fun, causing untold chaos in the process. The jump was allegedly to curb this. Sadly, that story apocryphal. In reality, it was just because it was economically favorable to be time-aligned with the state capital city. But I digress…
If you were, say, looking over historic records of events recorded in both Bismarck and Beulah, where records are always taken simultaneously, and your data happened to span back before this switchover, there would be an inexplicable point in time where after it the timestamps would match, but before it, they’d be offset. So, to encode that, Beulah gets its own unique timezone all to itself that indicates this historical switchover exists.
It also explains why there are three tiny timezones all right next to one another. Three counties participated in this switchover, and to make it happen, each one had to individually pass laws to enact it. These laws all took effect on slightly different dates. Thus, if we wish to capture the nuanced time shifts in all three counties, each county needs its own bespoke timezone.
IANA timezones aren’t just representations of all the time zones that currently exist. They are representations of every unique permutation of historic clock changes for every place on Earth. That’s fucking nuts! Knowing that, I went from being shocked that there are so many timezones to being shocked that the list of timezones is as short as it is!
I definitely don’t agree that the RFC is easier to read, the two numbers can appear to be one at a quick glance without a separator.
But there is a separator between the numbers: the same one that also very reliably separates the words in this comment
Both are valid (if you’d add seconds) in both RFC 3339 and ISO 8601, but timezone support is the same here and there…
I’m pretty sure the top one also is an RFC 3339 format. See https://ijmacd.github.io/rfc3339-iso8601/