💾 Archived View for jacksonchen666.com › posts › 2023-09-10 › 15-43-09 › index.gmi captured on 2023-11-14 at 07:57:29. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
2023-09-10 15:43:09Z
Date and time formats. It's that thing that people for some reason, cannot decide on at all, and instead make lots of nonsense.
You've probably seen expiry dates on food and stuff that expires. Have you ever been confused on whether it is Day/Month/Year, or Month/Day/Year, or Day/Year/Month, or Year/Month/Day, or whatever the fuck someone decided to use?
Ultimately, I think there's only 1 date and time formatting that makes sense: from the biggest, to the smallest.
Here's the order from biggest time unit, and the smallest time unit (that most people may care about):
1. Year
2. Month
3. Day
4. Hour
5. Minute
6. Seconds
So a date time format of Year/Month/Day Hour:Minute:Seconds should work, right?
Yes. Except for timezones.
Timezone abbreviations are my least favorite things. Mind you, I still haven't done enough computer programming to deal with date time stuff, so this is very much outside of computer programming. This timezone abbreviation issue is more of a communication problem.
Communication problem? What do I mean by that? Just say that your timezone is CEST and that's good enough.
Nope. What the fuck is "CEST" anyways? I'm sure the only person who knows every single timezone abbreviation and what timezone it actually corresponds to is someone who could spend 4 hours infodumping about timezones and time as well.
In case you didn't know what the CEST timezone is, you would have had to search online somewhere or refer to some table of timezones. That's very not ideal for understanding fast, and referring to something else is required.
The better solution would been to include the offset from UTC. In the case of CEST, that would be UTC+02:00 or 2 hours ahead of UTC.
Now, how do we combine everything together?
You've probably heard of it. There's even an XKCD for ISO 8601.
ISO 8601 is a standard for representing date time formats.
Here's the current date and time of what I have on my computer, in ISO 8601 format:
2023-09-10T17:11:53+02:00
The format is basically like this from left to right:
1. Year (4 digits)
2. Dash separator
3. Month (number, not name)
4. Dash separator
5. Day of month
6. Literal T separating time from the date
7. Hour
8. Colon separator
9. Minute
10. Colon separator
11. Seconds
12. Ahead or behind UTC indicator (+ is ahead, - is behind)
13. Hour offset from UTC
14. Colon separator
15. Minute offset from UTC
To simplify the format:
1. Date
2. Time
3. Timezone relative to UTC
The timezone part indicates the timezone of the time, so to change the timezone to UTC, it would result in this:
2023-09-10T15:11:53+00:00
That's the same date and time as above, just with a different timezone.
ISO 8601 also has an abbreviation for the UTC timezone, which is the letter Z, which can be used instead like this:
2023-09-10T15:11:53Z
Fun fact: I use ISO 8601 date time formatting for my website pretty much everywhere. The date would look something like this:
2023-09-10
And you can see that on my gemlog listings.
Oh, I think I may have to address the elephant in the room...
ISO documents aren't free by any means. They cost money, and ISO 8601 documents cost quite a bit of money.
So the alternative was RFC 3339, which is the alternative to the ISO 8601 standard. However, it's not the same as ISO 8601.
ISO 8601 to RFC 3339 comparison
And well... yeah. RFCs I guess.