Is there any standard for representing date ranges?

ISO 8601 represents the date in YYYY-MM-DD .

It does not seem to give any recommendations on how to represent the date range, for example:

 2013-01-01 => 2013-06-31 

Does ISO 8601 or another standard make a reasonable recommendation for representing date ranges?

Background: this should be used as the output of the toString() method of the DateRange object, the output of which can then be analyzed by the parse() method.

+14
date standards naming iso8601 date-range
source share
2 answers

ISO 8601 has a standard for representing date ranges. To represent the start and end dates using this format, you should write:

2013-01-01/2013-06-31

Notice how the slash is used as an interval pointer to separate start and end dates.

See here for more information.

+14
source share

To add Ben Smith's answer above, the standard also mentions the use of double hyphenation ( -- ) as a span in certain contexts instead of a slash ( / ). For example, in file or directory names where slashes are not allowed on most operating systems.

So the above examples will be

2013-01-01--2013-06-31

or

2013-01-01--06-31

in abbreviated form

+7
source share

All Articles