Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any kind of standard for representing date ranges?

ISO 8601 represents a date as YYYY-MM-DD.

It doesn't seem to offer any recommendation on how to represent a date range, for example:

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

Does ISO 8601, or another standard, give a sensible recommendation for representing date ranges?

Background: this is to be used as the output of the toString() method of a DateRange object, output which could then be parsed with a parse() method.

like image 447
BenMorel Avatar asked Dec 06 '13 00:12

BenMorel


People also ask

How do you indicate a date range?

Ranges. A simple year–year range is written using an en dash ( – , – or {{ndash}} ), not an em dash, hyphen, or slash; this dash is unspaced (that is, with no space on either side); and the end year is usually given in full: 1881–1882; 1881–1886 (not 1881–86); 1881–1992 (not 1881–92)

What is the most standard date format?

The United States is one of the few countries that use “mm-dd-yyyy” as their date format–which is very very unique! The day is written first and the year last in most countries (dd-mm-yyyy) and some nations, such as Iran, Korea, and China, write the year first and the day last (yyyy-mm-dd).

Is date in ISO format?

ISO 8601 represents date and time by starting with the year, followed by the month, the day, the hour, the minutes, seconds and milliseconds. For example, 2020-07-10 15:00:00.000, represents the 10th of July 2020 at 3 p.m. (in local time as there is no time zone offset specified—more on that below).

What is universal date format?

The international standard date notation is. YYYY-MM-DD. where YYYY is the year in the usual Gregorian calendar, MM is the month of the year between 01 (January) and 12 (December), and DD is the day of the month between 01 and 31.


Video Answer


1 Answers

ISO 8601 does have a standard for representing date ranges. To represent the start and end date using this format you would write:

2013-01-01/2013-06-31

Note how the forward slash is used as the interval designator to separate the start and end dates.

See here for more information.

like image 169
Ben Smith Avatar answered Sep 21 '22 17:09

Ben Smith