Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the --MM-DD format for month-day part of ISO 8601?

The Java 8 date/time API, java.time, has a MonthDay class to represent a month and a day together. So too the Joda-Time library offers a MonthDay class.

In java.time, the MonthDay.toString() method is declared as:

Outputs this month-day as a String, such as --12-03.

Most of the classes in java.time have their toString() method output the standard ISO 8601 representation of the concept they represent (YYYY-MM-DD for LocalDate, for example), so I would expect this --MM-DD format to be standard as well.

But I could not find this in the ISO 8601 standard.

Is month-day a concept defined by ISO 8601, and if so, is --MM-DD the standard format?

Background: I'm developing a date/time API in another language.

like image 586
BenMorel Avatar asked Aug 06 '14 13:08

BenMorel


People also ask

What is the date format according to ISO 8601?

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).

Is dd mm yyyy ISO format?

For example, the ISO standard defines the year format as YYYY, the year/month format as YYYY-MM, and the year/month/day format as either YYYYMMDD (basic format) or YYYY-MM-DD (extended format).

Does ISO 8601 include timezone?

Time zone designators. Time zones in ISO 8601 are represented as local time (with the location unspecified), as UTC, or as an offset from UTC.


1 Answers

Yes, in paragraph 4.4, ISO 8601:1988 says:

Note - The hyphen is also used to indicate omitted components

So the format --MM-DD conforms to ISO 8601, where the year is omitted/missing, and paragraph 5.2.1.3d also contains an example of that very format.

This format disappeared in later editions of the ISO 8601 standard. However, the java.time classes continue to support the format along with the MonthDay class.

like image 114
nos Avatar answered Oct 01 '22 03:10

nos