Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
ISO 8601
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Durations== {| class="infobox" style="text-align:center; width:23em" |- | PnYnMnDTnHnMnS |- | PnW |- | P<date>T<time> |} Durations define the amount of intervening time in a time interval and are represented by the format P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W as shown on the aside. In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required, but the maximum number of digits for each element should be agreed to by the communicating parties. The capital letters ''P'', ''Y'', ''M'', ''W'', ''D'', ''T'', ''H'', ''M'', and ''S'' are designators for each of the date and time elements and are not replaced. *''P'' is the duration designator (for ''period'') placed at the start of the duration representation. **''Y'' is the year designator that follows the value for the number of calendar years. **''M'' is the month designator that follows the value for the number of calendar months. **''W'' is the week designator that follows the value for the number of weeks. **''D'' is the day designator that follows the value for the number of calendar days. *''T'' is the time designator that precedes the time components of the representation. **''H'' is the hour designator that follows the value for the number of hours. **''M'' is the minute designator that follows the value for the number of minutes. **''S'' is the second designator that follows the value for the number of seconds. For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds". Date and time elements including their designator may be omitted if their value is zero, and lower-order elements may also be omitted for reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable duration representations. However, at least one element must be present, thus "P" is not a valid representation for a duration of 0 seconds. "PT0S" or "P0D", however, are both valid and represent the same duration. To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value). The smallest value used may also have a decimal fraction,<ref>{{Cite web |title=Data elements and interchange formats β Information interchange - Representation of dates and times β Part 1: Basic rules |url=https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf |url-status=live |archive-url=https://web.archive.org/web/20210312212543/http://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf |archive-date=2021-03-12 |access-date=2021-07-06 |website=The Library of Congress |page=23 |quote=b) If necessary for a particular application, the lowest order components may have a decimal fraction.}}</ref> as in "P0.5Y" to indicate half a year. This decimal fraction may be specified with either a [[comma]] or a [[full stop]], as in "P0,5Y" or "P0.5Y". The standard does not prohibit date and time values in a duration representation from exceeding their "carry over points" except as noted below. Thus, "PT36H" could be used as well as "P1DT12H" for representing the same duration. But keep in mind that "PT36H" is not the same as "P1DT12H" when switching from or to [[Daylight saving time]]. Alternatively, a format for duration based on combined date and time representations may be used by agreement between the communicating parties either in the basic format PYYYYMMDDThhmmss or in the extended format {{nowrap|P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]}}. For example, the first duration shown above would be {{nowrap|"P0003-06-04T12:30:05"}}. However, individual date and time values cannot exceed their [[modular arithmetic|moduli]] (e.g. a value of 13 for the month or 25 for the hour would not be permissible).<ref>ISO 8601:2004 section 4.4.3.3 Alternative format, ISO 8601-1:2019 section 5.5.2.4 Alternative format</ref> The standard describes a duration as part of time intervals, which are discussed in the next section. The duration format on its own is ambiguous regarding the total number of days in a calendar year and calendar month. The number of seconds in a calendar day is also ambiguous because of [[leap second]]s. For example "P1M" on its own could be 28, 29, 30, or 31 days. There is no ambiguity when used in a time interval. Using example "P2M" duration of two calendar months: * interval 2003-02-15T00:00:00Z/P2M ends two calendar months later at 2003-04-15T00:00:00Z which is 59 days later * interval 2003-07-15T00:00:00Z/P2M ends two calendar months later at 2003-09-15T00:00:00Z which is 62 days later The duration format (or a subset thereof) is widely used independent of time intervals, as with the Java 8 Duration class which supports a subset of the duration format.<ref>{{Cite web |title=Java 8 Class Duration |url=https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence- |url-status=live |archive-url=https://web.archive.org/web/20171014075752/https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence- |archive-date=2017-10-14 |access-date=2017-10-07 |website=Java Platform Standard Edition 8 |publisher=Oracle}}</ref><ref>{{Cite web |title=Amazon Alexa Duration |url=https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#duration |url-status=live |archive-url=https://web.archive.org/web/20171014075804/https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#duration |archive-date=2017-10-14 |access-date=2017-10-07 |website=Amazon Developer |publisher=Amazon.com}}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
ISO 8601
(section)
Add topic