TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

RFC 3339 vs. ISO 8601

514 pointsby rdpintqogeogsaaover 3 years ago

20 comments

NelsonMinarover 3 years ago
Note that Python still lacks any way to parse these dates in the standard library. You have to use a third party library to parse them. You might think `datetime.fromisoformat` parsed ISO dates but you&#x27;d be wrong; it doesn&#x27;t support the trailing Z or any other form of timezone information. The docs are clear about this, and the developer discussion I&#x27;ve read basically boils down to &quot;it&#x27;s too hard to parse ISO dates so we didn&#x27;t do it here.&quot; This discussion has been going on for years.<p><a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;127803&#x2F;how-do-i-parse-an-iso-8601-formatted-date" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;127803&#x2F;how-do-i-parse-an...</a>
评论 #28980460 未加载
评论 #28982785 未加载
评论 #28983406 未加载
em500over 3 years ago
This is very neat, but maybe not completely accurate. &quot;2021-10-24 11:02:03Z&quot; is outside iso8601 in the figure, but I think it&#x27;s valid iso8601. True, &quot;T&quot; is the One True date-time separator in iso8601 (IMO its biggest wart, as it looks awful for human eyes: &quot;2021-10-24T11:02:03Z&quot;). But according to the draft standard[1], page 21:<p>&gt; By mutual agreement of the partners in information interchange, the character [T] may be omitted in applications where there is no risk of confusing a date and time of day representation with others defined in this International Standard<p>[1] The actual ISO standard is not freely available, but the Library of Congress has free draft standards: <a href="https:&#x2F;&#x2F;www.loc.gov&#x2F;standards&#x2F;datetime&#x2F;iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf" rel="nofollow">https:&#x2F;&#x2F;www.loc.gov&#x2F;standards&#x2F;datetime&#x2F;iso-tc154-wg5_n0038_i...</a> <a href="https:&#x2F;&#x2F;www.loc.gov&#x2F;standards&#x2F;datetime&#x2F;iso-tc154-wg5_n0039_iso_wd_8601-2_2016-02-16.pdf" rel="nofollow">https:&#x2F;&#x2F;www.loc.gov&#x2F;standards&#x2F;datetime&#x2F;iso-tc154-wg5_n0039_i...</a>
评论 #28977036 未加载
评论 #28977955 未加载
评论 #28977136 未加载
评论 #28976982 未加载
评论 #28986607 未加载
评论 #28976988 未加载
gorgoilerover 3 years ago
…and none of these do timezones properly! If your birthday party is:<p><i>2022-05-01T16:00+1000</i><p>…but tomorrow’s government abolishes daylight savings time, your birthday event has to change to:<p><i>2022-05-01T16:00+0900</i>.<p>If you’d just said:<p><i>2022-05-01T16:00 Asia&#x2F;Eastern_Siberia</i><p>…you’d be fine and everyone will show up at the right time.
评论 #28977983 未加载
评论 #28977711 未加载
评论 #28979083 未加载
评论 #28978066 未加载
评论 #28978652 未加载
评论 #28979393 未加载
zestypingover 3 years ago
Because the digits are of varying widths in the standard Apple system font, the ticking seconds cause the date strings to jiggle back and forth and the table column widths to jiggle as well!<p>However, you can use CSS to select the fixed-width variant for digits. This is a perfect example of a use case for:<p><pre><code> * { font-variant-numeric: tabular-nums; }</code></pre>
TacticalCoderover 3 years ago
I never really thought about six-digits years (I don&#x27;t really understand what is meant by &quot;by mutual agreement&quot;): is this something in use today and by whom? Who needs six-digits years and <i>only</i> six digit years? I mean: if you&#x27;re projecting stuff in the future (like, say, continental drift), you&#x27;ll be stuff at year 99999 and have the exact same problem of wrapping around back to zero when you&#x27;d need year 1000000 no?<p>Or is it &quot;infinite&quot;: as in, the spec allows for 8-digits years, 10, etc.?
评论 #28977001 未加载
评论 #28976847 未加载
hendryover 3 years ago
RE time standards, I always thought it was interesting how WHATWG took a subset of ISO 8601 since ISO went off the rails wrt poorly defined complexity.<p><a href="https:&#x2F;&#x2F;html.spec.whatwg.org&#x2F;multipage&#x2F;common-microsyntaxes.html#dates-and-times" rel="nofollow">https:&#x2F;&#x2F;html.spec.whatwg.org&#x2F;multipage&#x2F;common-microsyntaxes....</a>
Waterluvianover 3 years ago
Does anyone know of a website that lets you paste in date strings and it will show you all the possible formats they adhere to along with their format strings?<p>I often come across a string and don’t recognize the format and would love to just supply a bunch of examples and make a best guess.
评论 #28979345 未加载
bla3over 3 years ago
<a href="https:&#x2F;&#x2F;datatracker.ietf.org&#x2F;doc&#x2F;html&#x2F;rfc3339" rel="nofollow">https:&#x2F;&#x2F;datatracker.ietf.org&#x2F;doc&#x2F;html&#x2F;rfc3339</a> says that rfc339 is a&quot;profile of iso8601&quot; -- shouldn&#x27;t it be a true subset?<p>Also, I read through that RFC several times and didn&#x27;t find where it allows replacing &#x27;Z&#x27; with space. Can anyone else find it?
评论 #28977204 未加载
pletnesover 3 years ago
The use of colon in timestamps is incompatible with several filesystems and this just drives me nuts.
评论 #28977016 未加载
评论 #28980634 未加载
评论 #28978425 未加载
评论 #28976777 未加载
评论 #28983474 未加载
评论 #28978935 未加载
评论 #28979207 未加载
tgsovlerkhgselover 3 years ago
The one big failure of RFC 3339 is that it doesn&#x27;t specify the actual rules for the separator:<p><pre><code> Applications using this syntax may choose, for the sake of readability, to specify a full-date and full-time separated by (say) a space character. </code></pre> Is separating it by a tab valid? A tilde? An underscore, as this website shows? Since this is so underspecified, there will be receivers that accept only T, and others that accept the T and some arbitrarily chosen character set. The ABNF only allows T.<p>I don&#x27;t know how a standard that was specifically written to resolve the issues resulting from such ambiguities ended up with such a crucial issue.
willis936over 3 years ago
Is the timezone necessary to be compliant? My favorite ISO 8601 format is &quot;%Y%M%DT%h%m%s%&quot;, but the table includes a &quot;−Z&quot; on the end and the &quot;Now&quot; column evaluates this as my current timezone.<p>It says the list isn&#x27;t exhaustive, but I&#x27;m just curious how often others actually embed the timezone rather than just passing around UTC.
评论 #28976789 未加载
评论 #28977086 未加载
评论 #28976812 未加载
评论 #28976688 未加载
vsliraover 3 years ago
As someone who frequently works with datetime data, I always felt that in the format YYYY-MM-DDTHH:mm±ZZ:ZZ, it should read &quot;this local time plus the timezone offset gives you utc&quot;, not &quot; utc plus the timezone offset gives you this local time&quot;, so basically invert the signal from how it is now.
评论 #28978814 未加载
emilfihlmanover 3 years ago
Still missing the best<p>%F %T %z<p>(Ie %Y-%m-%d %H:%M:%S %z)<p>Though adding nanoseconds is also recommended.
评论 #28978051 未加载
miklover 3 years ago
In short, RFC 3339 has all the useful formats we think of when we invoke ISO 8601. The ISO standard has those too, as well as a seemingly endless list of additional obscure and esoteric formats almost no one uses.
venthurover 3 years ago
I&#x27;m surprised that neither of them has standardized the quarter, i.e. 2021-Q1. This is fairly common in business.
评论 #28977264 未加载
评论 #28977472 未加载
yeetaccountover 3 years ago
All this just makes it clear to me that we need a time standard which addresses all the problems and of ISO8601. It’ll be painful until it’s universally adopted, but once it is we’ll be in timekeeping heaven.
jacobmischkaover 3 years ago
I like the concept of ISOs in general, but I personally prefer RFC 3339. The space makes it so much easier to read at a glance, and I can&#x27;t imagine it makes parsing much different algorithmically?
评论 #28979196 未加载
评论 #28977024 未加载
merbover 3 years ago
do you now whats ridiculous? that we germans (and europeans) also use the iso 8601 but it&#x27;s still allowed to use din 5008 and the european date and time notations... WHY??? it&#x27;s so stupid to use dd.MM.yyyy, it&#x27;s worse in every way to yyyy-MM-dd. worse than that the old notation is preferred in most official documents..... WHY....
评论 #28982426 未加载
评论 #28983473 未加载
iimblackover 3 years ago
Is there a reason to not just use Unix timestamps? That’s how I’ve been passing datetimes in my api and storing them in my db.
评论 #28981151 未加载
Zekioover 3 years ago
I keep hoping the whole world will switch to a single timezone utc, that way so many things would be simpler
评论 #28992832 未加载
评论 #28985488 未加载