Вопрос

What does dashes mean in ISO 8601 date and time format?

--0412
--1022T1410
---12

Is it current year and month, some "minimum" year or anything else?

If its a current year, does this means I can not represent it in DateTimeOffset object in .Net because it will set some specific year and month when parsing '---12' string?

Это было полезно?

Решение

In ISO 8601:1998 and ISO 8601:2000 they are known as truncated representations where each hyphens indicate omitted components.

--MMDD represents a specific day of the month in the implied year. Truncated representations where removed in ISO 8601:2004 because it introduced an ambiguity in truncated representations with implied century.

Другие советы

"In certain application areas a double hyphen is used as a separator instead of a solidus.". (Notations like 2000--2002 were promoted by previous versions of the standard.)

The ISO 8601 standard does not specify whether a date or time (or date and time) designation refers to a singular point in time or a time period. In particular, a designation of a date can be used to refer to a full 24-hour day or a specific moment of time within it, probably by default the start of the day (00:00). Similarly, a time notation like 9:00 could refer to nine o'clock absolutely sharp or the period from 09:00 to 09:01 or anything else. When necessary, a specific agreement or verbal indication of the meaning can be given, or the most explicit notation with ISO 8601 could be used. For example, one could write 09:00:00 or 09:00:00/09:01:00 to distinguish between the two interpretations mentioned above.

Source

Also recommend you read the following:

Standard Date and Time Format Strings

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top