I'm currently making a list of events I want to attend this year, and was wondering whether there's a standard for writing date ranges. Turns out there is! Thread on some other weird things I found while reading the Wikipedia article:

Short refresher on ISO 8601, *the* correct way to write numeric dates ( The standard uses the Gregorian Calendar, and goes from most to least significant component:

2020-02-15 = February 15 of this year
2020-02 = February of this year.
2020 = This year.

Show thread

Let's look at some weirder stuff! By convention:

0000 = Year 1 BCE
0001 = Year 1 CE

To express years before 0000 or after 9999, you prefix the year with - or +:

-752 = Year 753 BCE
+30000 = Year 30000

Show thread

You can denote a week date like this:

2020-W07 = The week with the 7th Thursday of the year in it.

An equivalent definition: ISO week number 1 is the first one where a majority of the week's days (starting with Monday) are in the respective year!

Show thread

You can also denote the n-th day of a certain ISO week – again, starting with Monday:

2020-W07-6 = 6th day of the 7th week of 2020 = 2020-02-15

This is so weird, I've never seen this, but I actually have a use case (for weekly planning)!

Show thread

Times can be added after a "T", in 24-hour format:


For more precision, add seconds:


For less precision, drop the minutes:


Show thread

RFC 3339, a standard for date and time notations for Internet protocols (which is mostly a subset of ISO 8601) also allows separating date and time with other characters, like a space, and I often do that for better readability. But ISO 8601 does not allow that. :P

Show thread

When to time zone information is present, the time is assumed to be in local time.

Add a "Z" for a time in UTC (apparently, this comes from nautical time notation where Z is used for the "zero zone"):

13:37Z = 13:37 in Coordinated Universal Time

Show thread

UTC offsets can be appended with a + or - in the form "hh:mm", "hhmm" or "hh":

13:37+01 = 13:37 in (for example) Central European Time
13:37+05:30 = 13:37 in (for example) Indian Standard Time

Instead of adding "Z", adding "+00" is also possible.

Show thread

There's a syntax for specifying durations! They start with "P" for period, followed by the number of Y(ears), M(onths), W(eeks), D(ays). Then, after a "T", you can list the number of H(ours), M(inutes) and S(econds):

P4Y = 4 years
PT48H = 48 hours
P1YT1S = 1 year and 1 second

Show thread

And finally, the interval syntax I was looking for: use a "/" (or a "--" in filenames) to separate the start and end value. You can omit redundant elements from the beginning of the end value:

2020-02-10/16 = February 10 to 16
2020-01-15/02-15 = January 15 to February 15

Show thread

You can also use a duration after the "/"!

2020-01-15/P1M = 2020-01-15/02-15
2020-02-15T13:37/PT1H = 2020-02-15T13:37/14:37

Show thread

You can specify repeating intervals by adding the prefix "R/":

R/2020-02-15/P2W = Every second Saturday, starting today.
R/2019/2023 = Every 4 years, starting in 2019.

Show thread

And optionally, you can specify the number of repetitions after the "R":

R100/13:37:00+01/PT1H = 100 one-hour intervals starting at 13:37 CET.

Show thread

That's all I got! Back to making a list of events and their dates… in a *very concise, well-defined notation*! \:D/

Show thread

@blinry thanks, I learned things about ISO8601 in this thread I had never heard about before!

@blinry Is this valid?

@ruru4143 To my understanding, there's no "double period" range notation. What would you like to express with that?

@blinry this should express every past cccongress. there are two strings because congress changed his length in 2006.
In general it should express a annual event lasting several days

@ruru4143 Oh, such a notation would be super useful, yeah! :)

@blinry wait, is this duration and recurrence syntax still ISO 8601? because it sure comes in handy!

Sign in to participate in the conversation – a Fediverse instance for & by the Chaos community