© 2018 The Calendaring and Scheduling Consortium, Inc.
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from the address below.
The Calendaring and Scheduling Consortium, Inc.
4390 Chaffin Lane
McKinleyville
California 95519
United States of America
copyright@calconnect.org
www.calconnect.org
The Calendaring and Scheduling Consortium (“CalConnect”) is a global non-profit organization with the aim to facilitate interoperability of technologies across user-centric systems and applications.
CalConnect works closely with liaison partners including international organizations such as ISO, OASIS and M3AAWG.
The procedures used to develop this document and those intended for its further maintenance are described in the CalConnect Directives.
In particular the different approval criteria needed for the different types of CalConnect documents should be noted. This document was drafted in accordance with the editorial rules of the CalConnect Directives.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. CalConnect shall not be held responsible for identifying any or all such patent rights. Details of any patent rights identified during the development of the document will be in the Introduction and/or on the CalConnect list of patent declarations received (see www.calconnect.com/patents).
Any trade name used in this document is information given for the convenience of users and does not constitute an endorsement.
This document was prepared by Technical Committee DATETIME.
However, the representations provided in
This document extends the “duration” representation
defined in
The purpose of this document is to provide:
a standard, declarative representation of date and time and time scale components called the “explicit form”;
a grouped time scale unit mechanism for grouping of date and time; and
new duration representations and mechanics for the calculation of date time formulas involving duration.
This document only supports date elements from the Gregorian calendar and times from the 24-hour clock.
Date and time format representations described in this document
utilizes numbers, alphabets and symbols defined in
For the purposes of this document, the terms and definitions
given in
date and time representation that uses designator symbols to delimit time scale components
characters used to denote units of a time scale component
expression that specifies modification of a date and time expression (
time scale component (
time scale unit (
Representations specified in this document make use of symbols given in
time scale component century in explicit form
the left side of representation statement where “c” is a time scale component (e.g. “year”) and “feat” is a feature, for example, “m” for a time scale component that accepts negative values
time scale component calendar day of month in explicit form
time scale component calendar day of week in explicit form
time scale component calendar day of year in explicit form
time scale component decade in explicit form
time scale component clock hour in explicit form
time scale component clock minute in explicit form
time scale component calendar month in explicit form
time scale component clock second in explicit form
time scale component calendar week of year in explicit form
time scale component calendar year in explicit form
the composite time scale components for the complete representation of a time of day as determined in
the composite time scale units for the representation of a duration as determined in
the composite time scale components for the complete representation of a date as determined in
the composite time scale component for time shift in basic form with hours and minutes, as determined in
These symbols are used to represent characters in the date and time representations. They are used in representations only, and are replaced by one or more characters, as described, in expressions:
indicates that the token following this symbol is optional (may be omitted)
a positive integer or value, may be left absent to signify an unbounded value
a positive or negative integer; equivalent to [!]["-"][i]
a positive integer
These symbols are used to represent designators in the date and time expressions:
a minus sign represented by the character “`-”` to indicate a negative value
the suffix designator to represent years before year one, represented by the character “B”, placed after the time scale components of calendar year, decade and century.
the day of month designator, represented by the character “D”, preceding a data element which represents the number of days in a month
the grouped time scale unit prefix designator, represented by the character “G”, indicates a grouping calculation applies to the subsequent time scale components until encountering the corresponding suffix designator.
the hour designator, represented by the character “H”, preceding a data element which represents the number of hours
the decade designator, represented by the character “J”, preceding a data element which represents the number of decades
the calendar day of week designator, represented by the character “K”, preceding a data element which represents the ordinal number of a calendar day within a calendar week
the month or minute designator, represented by the character “M”, preceding a data element which represents the number of months or minutes
the calendar day of year designator, represented by the character “O”, preceding a data element which represents the ordinal number of a calendar day within a calendar year
the duration designator, represented by the character “P”, preceding the component which represents the duration
the second designator, represented by the character “S”, preceding a data element which represents the number of seconds
the time designator, represented by character “T”, indicates:
the start of the representation of local time of day to designate local time of day expressions as such,
the start of the representation of the time of day in date and time of day expressions,
the start of the representation of the number of hours, minutes or seconds in expressions of duration
the grouped time scale unit suffix designator, represented by the character “U”, indicates a grouping calculation applies to the preceding time scale components from the corresponding prefix designator.
the week designator, represented by the character “W”, preceding a data element which represents the ordinal number of a calendar week within the calendar year
the year designator, represented by the character “Y”, preceding a data element which represents the number of years
the UTC designator, represented by the character “Z”, added to the end of a time representation to indicate that a time of day is represented as UTC of day.
the representation of any character “x” as according to the textual representation of “x” in the
Although “M” can be used to designate months or for minutes, its meaning is unambiguous in expressions because the time portion shall always be preceded by the time designator “T”.
The designator symbol “J” is assigned from its ordinal position being the tenth letter of the English alphabet.
The “G” and “U” designator symbols are used to demarcate the “grouped time scale unit” time scale components as they form the initial letters of the words “group” and “unit”.
In date and time expressions and date and time representations, the following characters are used as separators.
the “.” period and “,” comma characters are decimal signs used to separate the integer part from the decimal fraction of a number.
the “/” solidus character separates start and end times in the representation of a time interval, as well as the symbol ‘R’ from the remainder of a recurring time interval representation. A solidus may be replaced with a double hyphen [“—”] by mutual agreement of the communicating partners.
Additional properties and the explicit forms of time scale units are represented in this clause.
This document refers to an “order” amongst time scale units, which is defined by the duration of a time scale unit relative to other time scale units. For example, since a single calendar month has a duration always greater than a single unit of calendar day, the former is considered of a higher order time scale unit than calendar day, and therefore the latter is also considered of a lower order time scale unit than the former.
The relative order of commonly used time scale units is specified below, with the higher listed entry considered a higher order time scale unit than a lower listed entry:
calendar century
calendar decade
calendar year
calendar month
calendar week
calendar day
clock hour
clock minute
clock second
a higher order time scale does not necessarily mean its duration can be expressed as an integer multiple of a lower order time scale, for example, in the case of calendar month (28, 29, 30 or 31 days) and calendar week (7 days).
Prefixing of the value with one or more “`0`”s (the number zero) to the integer [i] is allowed in the explicit forms of time scale components.
‘1M’, ‘01M’, and ‘0001M’ all describe the calendar month January.
The calendar year and years duration is represented as follows:
‘12Y’, duration, twelve years
‘12Y’, date, year 12.
The calendar month and months duration is represented as follows:
‘6M’, duration, 6 months.
‘8M’, date, the month of August.
The calendar week of year number and weeks duration is represented as follows:
‘10W’, duration, ten weeks.
‘22W’, date, the twenty-second calendar week of a calendar year.
The calendar day of month and days duration is represented as follows:
‘130D’, duration, 130 days.
‘25D’, date, the twenty-fifth (25) calendar day of a calendar month.
The calendar day of week is represented as the following time scale component:
Where,
[i] represents the ordinal day number in the calendar week;
valid values of [i] are the integers 1 to 7, representing Monday to Sunday,
in accordance with “The week calendar” specified in
‘1K’, calendar day of week Monday
‘3K’, calendar day of week Wednesday
‘7K’, calendar day of week Sunday
The calendar day of year is represented as the following time scale component:
‘351O’, ordinal day 351 of the calendar year
Clock hour and hours duration is represented as follows:
‘36H’, duration, thirty-six hours.
‘6H’, time, the sixth clock hour.
Clock minute and minutes duration is represented as follows:
‘72M’, duration, 72 minutes.
‘56M’, time, the fifty-sixth clock minute.
Clock second and seconds duration is represented as follows:
‘300S’, duration, 300 seconds
‘28S’, duration, the twenty-eighth clock second.
The decade is represented as the following time scale component:
‘196J’ in explicit form represents the decade of the 1960s, spanning the calendar years 1960 to 1969.
‘0J’ in explicit form represents the decade spanning calendar years 0 to 9.
The century is represented as the following time scale component:
‘16C’, in explicit form represents the century of 1600s, spanning the calendar years 1600 to 1699.
‘0C’, in explicit form represents the century spanning the calendar years 00 to 99.
Certain time scale components are allowed to accept a negative integer as their value. The following representation is used for value that accepts a positive or negative integer.
In order to convert a time scale component to accept negative values, the following representation is used, where c is a time scale component unit. If the time scale component accepts an integer value of ‘0’, the value of the expression ‘-0’ (negative zero) is considered equivalent to that of ‘0’.
Where,
[c] is the time scale component representation that accepts only positive [i];
[m] is a feature label indicating that the time scale component [c] accepts negative values.
This representation only applies to time scale components that describe a time scale unit. Specifically, it does not apply to durations, time intervals, and repeating time intervals.
If “c” is the time scale component yearE in explicit form (see Part 1 4.3.2 b)), c(m) means “calendar year accepting a negative value”. The explicit year representation [i][“Y”] becomes [negi][“Y”] when [i] is replaced with [negi], and expands to [!][“-”]][i][“Y”], which accepts the representations [i]["Y`"] or ["-"]"Y"]. In this expression, the value of [i] or ["-”`][i] represents an integer whose value identifies a calendar year.
When a negative calendar year represents a date, the negative value is to represent the number of years prior to year zero (0).
The representation for calendar year that accepts a negative value is as follows.
‘-12Y’ in date represents the the calendar year -12.
‘-1Y’ in date represents the year immediately preceding year 0.
Year zero is expressed as ‘0Y’ in explicit form.
When a negative calendar week of year represents a date, the negative value is to represent the number of weeks counting in reverse from the end of the calendar year, where the last week of the year is represented by the integer value ‘-1’.
The representation for calendar week of year that accepts a negative value is as follows.
‘-10W’ in date represents the tenth last week of the year.
‘-3W’ in date represents the third last week of the year.
When a negative calendar day of month represents a date, the negative value is to represent the number of days counting in reverse from the end of the calendar month, where the last day of the month is represented by the integer value ‘-1’.
The representation for calendar day of month that accepts a negative value is as follows.
‘-1D’ in date represents the last day of the month.
‘-5D’ in date represents the fifth last day of the month.
When a negative calendar day of year represents a date, the negative value is to represent the number of days counting in reverse from the end of the calendar year, where the last day of the year is represented by the integer value ‘-1’.
The representation for calendar day of year that accepts a negative value is as follows.
‘-7O’ in date represents the seventh last day of the calendar year, which is always December 25th.
‘-306O’ in date represents February 29th for a leap year, February 28th otherwise.
A duration in the reverse direction, called a “negative duration” in
this document, can be expressed using the following representation
based on the duration representation specified in
Where,
[positive-duration] is the [duration] representation that contains only time scale components that have positive [i].
‘-P100D’ in date represents the duration of 100 days in the reverse direction.
‘-P1Y3D’ in date represents the duration of one years and three days in the reverse direction.
‘-P20Y3M’ describes a negative duration of twenty years and three months ago.
A suffix addition to time scale components for calendar year, decade and century allows representation of calendar years before year one (1).
The representation is given as follows.
Where,
[c] is one of [yearE], [decE], [centE].
‘1YB’ the first year before year one, equivalent to the effect of ‘0Y’.
‘12YB’ the twelfth year before year one, equivalent to the effect of ‘-11Y’.
‘12JB’ the twelfth decade before year one, equivalent to the effect of time interval ‘-119/-110’.
‘12CB’ the twelfth century before year one, equivalent to the effect of time interval ‘-1190/-1100’.
A time scale unit can be grouped into a larger composite unit that can each be specifically referred to using representations provided in this clause.
A grouped time scale unit (“grouped unit”) defines a time scale unit that is a composite of smaller time scale units. Its representation is provided as follows and is denoted as [groupUnit] in this document.
Where,
[“G”] is the grouping prefix designator;
[“U”] is the grouping suffix designator;
[durationUnits], one or more time scale components for
expressing positive duration as specified in
The definition of a grouped unit is a continuous one, such that there is no gap between two adjacent grouped units.
‘G10DU’, every unit of the grouped unit is of ten days duration.
‘GT30MU’, every unit of the grouped unit is of thirty minutes duration.
‘G2DT6HU’, every unit of the grouped unit is of two days and six hours duration.
The value of a grouped time scale unit is given with the following representation. This representation is denoted as [group] in this document.
Where,
[i] indicates the coefficient value of the grouped time scale unit;
[groupUnit] denotes an expression for a grouped time scale unit
(
‘5G10DU’, the fifth unit of ten-day groups.
‘20GT30MU’, the twentieth unit of thirty-minute groups.
‘2G2DT6HU’, the second unit of two-day groups.
‘2018-02-GP14D2I’ and ‘2018Y02MGP14D2ID’ are complete date representations that indicates “the second fortnight of February 2018”, as specified by the rule “group every 14 days, second group”.
‘2018-03-GP10D3I’ and ‘2018Y03MGP10D3ID’ are complete date representations that indicates “the third 10-day block of March in 2018”, as specified by the rule “group every 10 days, third group”. A 10-day block is a time grouping commonly used in East Asia.
’16:GPT15M1I:00’ and ‘T16HGPT15M1I0S’ are complete time representations that indicates “the first quarter-hour of 16:00”, as specified by the rule “group every 15 minutes, first group”.
‘2018-GP6M1I’ and ‘2018YGP6M1IM’ are date expressions (implied and explicit formats, respectively) of monthly precision that indicates “the first half of 2018”, as specified by the rule “group every 6 months, first group”, and therefore the grouping is specified in the [month] field. The resulting time interval is equivalent to the time interval expression ‘2018-01-01/2018-06-30’.
Grouped time scale units can be applied to date and time representations as replacements for any time scale unit components as long as the resulting expression is a valid one.
2018Y3G60DU6D is a valid date expression that refers to the date year 2018, ordinal day of year 186 (which is July 5th).
2018Y9M2DT2GT8HU0H30M is a valid date and time expression that refers to the date year 2018, September 2nd, 16:30.
Date and time representations can incorporate the grouped
time scale units by applying rules from
The following representation is used for date and time representations (complete representation, reduced precision) that incorporate grouped time scale units. This representation is denoted as [groupDateTime] in this document.
Where,
[higher-order-units] contains time scale units (and their values) that are of higher order compared to the highest order time scale unit within the group unit;
[lower-order-units] is optional, it contains time scale units (and their values) that are of equal or lower order compared to the lowest order time scale unit within the group unit.
[monthE][group][yearE] is an invalid date and time representation as [monthE] has a lower order than that of [yearE].
When [lower-order-units] is omitted, the expression refers to a unit of the grouped time scale unit.
[centE][group] is a valid date and time representation, expressing in units of the grouped time scale unit.
‘2018Y1G60DU’ represents the first 60-day group of the year 2018.
‘2018Y2M2G14DU’ refers to the second 14-day group in February of year 2018, which is in effect referring to “the second fortnight of February 2018”.
‘2018Y3M3G10DU’ refers to the third 10-day block of March in 2018. A 10-day block is a time grouping commonly used in East Asia.
‘T16H1GT15MU’ refers to the first quarter-hour of 16:00.
When [lower-order-units] is present, the expression refers to a date and time using the lowest time scale unit in the [lower-order-units] expression.
Time scale components placed to the right of a grouped time scale unit behaves identically to those after a typical time scale component, such that the component to the right refers to an instance or time interval “within” the component at the left.
[yearE][group][dayE] is a valid date and time representation, expressing in the calendar day time scale unit. The [dayE] points to a calendar day within the expression [yearE][group].
[decE][group][timeE] is a valid date and time representation, expressing in the lowest order time scale units specified in [timeE], which is the clock second time scale unit. The [timeE] points to a clock time within the expression [decE][group].
‘2018Y3G60DU6D’ represents the sixth day of the third 60-day group of the year 2018.
‘2018Y20GT12HU3H’ represents the third hour within the twentieth 12-hour group of the year 2018.
Time scale unit values provided in [lower-order-units] must not fall outside of the value bounds set by the group time scale unit (the [group] expression).
‘2018Y1G2MU30D’ refers to the thirtieth day of the first two-month group in year 2018. Since the first two-month group of 2018 contains 59 days, the subsequent expression 30D falls within the same grouped time scale unit.
‘2018Y1G2MU60D’ refers to the sixtieth day of the first two-month group in year 2018. It is an invalid expression as the first two-month group of 2018 only contains 59 days, the expression 60D falls outside of the same grouped time scale unit.
A representation using grouped time scale units can be represented with a time shift as:
‘2018Y1G60DUZ-5H’, the first 60-day group of the year 2018, five hours behind UTC.
‘2018Y3G60DU6DZ8H’ represents the sixth day of the third 60-day group of the year 2018, eight hours ahead of UTC.
When an expression referring to a grouped time scale
unit has to be converted to use basic time scale units
(time scale units that are defined in
‘2018Y1G6MU’ refers to the first 6-month group of year 2018. The resulting time interval is equivalent to that of the time interval expression ‘2018Y1M/2018Y6M’.
When the duration of a grouped time scale unit does not cleanly divide the original time scale component, the duration of the last unit of the grouped time scale is only partially located within the boundaries specified by the original time scale component.
In this case, the particular grouped time scale unit refers only to the duration that is within bounds of the original time scale component. The remaining duration that are out of bounds shall be truncated.
2018Y9M4G8DU refers to the “fourth 8-day grouping of September of year 2018”, but the fourth grouped unit only has 6 days within September and 2 days in October. According to the truncation rule, only the first 6 days belong to this grouped unit, and the resulting time interval is 2018-09-25/2018-09-30.
In order to express a time interval covered by the grouped unit without regard to the boundaries of the original time component, the same expression can be provided using time interval representation.
2018Y9M4G8DU, “fourth 8-day grouping of September of year 2018”, the start date of the fourth grouped unit can be found as 2018Y9M25D. Therefore, the expression of 2018Y9M25D/P8D provides the full 8-day duration of the unit, in the interval 2018Y9M25D/2018Y10M2.
This section provides date and time representations using explicit form.
The representations provided in this clause are collectively denoted as [dateE].
The complete representation of a calendar date shall be as follows.
‘1985Y4M12D’, calendar year 1985, April 12th.
A complete representation of an ordinal date shall be as follows.
‘1985Y102O’, calendar year 1985, ordinal day 102 of year.
A complete representation of a week date shall be as follows.
‘1985Y15W5K’, calendar year 1985, Friday of the calendar week 15.
Representations of local time of day as defined below make no
provisions to prevent ambiguities in expressions that result from
discontinuities in the local time scale (e.g. daylight-saving time).
When the need arises to prevent these ambiguities, the representations
provided in
A complete representation of local time of day shall be as follows. This representation shall be denoted as [timeE].
‘T23H20M50S’, a local time of day expression describing the fiftieth seconds of the twentieth minute of the twenty-third clock hour.
The complete representation of beginning of day in explicit form shall be as follows.
Applying the rule of omitting zero-valued time scale components, it can also be represented as:
There is no representation of end of day to prevent ambiguity of the overlapping end of day and the beginning of the next day.
A time shift is used to represent the shift of local standard time against UTC.
The complete representation of time shift in explicit form is represented as follows, and is denoted as [shiftE] within this document.
Where,
[“Z”] is the time shift designator;
the leading minus sign ([“-”]) is only applied when the time shift expressed is behind UTC, it shall be omitted if the time shift is ahead of or equal to UTC;
the expression [timeE] indicates the actual time shift from UTC.
In accordance with
‘Z-5H’, the time shift is 5 hours behind UTC.
‘Z8H’, the time shift is 8 hours ahead of UTC.
‘Z6H0M’, the time shift is six hours ahead of UTC; the expression ‘0M’ may be omitted
in accordance with
‘Z8H30M10S’, the time shift is eight hours, thirty minutes and ten seconds ahead of UTC.
A single [“Z”] with the [timeE] portion empty, in accordance with the
rules specified in
‘Z’, UTC where the time shift is zero.
‘Z0H0M’, UTC where the time shift is zero.
The complete representation for date with a time shift is as follows.
‘1985Y4M12DZ-5H’, calendar year 1985, April 12th with a time shift of 5 hours behind UTC.
The complete representation for time of day with a time shift is as follows.
‘T23H20M50SZ’, 23:20:50 at UTC of day.
‘T23H20M50SZ-5H0M’, 23:20:50 at local time, which is 5 hours behind UTC.
‘T23H20M50SZ8H’, 23:20:50 at local time, which is 8 hours ahead of UTC.
A time can be expressed by combining a date expression (
The date part of a date and time expression must be complete. The time
may be incomplete (
The representations provided in this clause are collectively denoted as [datetimeE].
The complete representation for date and time only is as follows.
‘1985Y4M12DT23H20M30S’, calendar year 1985, April 12th, 23:20:30.
The complete representation for date with time and a time shift is as follows.
‘1985Y4M12DT23H20M30SZ8H’, calendar year 1985, April 12th, 23:20:30, 8 hours ahead of UTC.
The complete representation for decade is as follows.
‘1880’, the decade 1880s, spanning years from 1880 to 1889.
The complete representation for century is as follows.
‘1300’, the century 1300s, spanning years from 1300 to 1399.
Time scale components within an explicit form that has a value of 0 may be omitted entirely with its corresponding designator, except when the omission of it affects the indication of precision.
In the representations given in this clause, if a time scale component of a higher order (compared to the lowest order component specified in the representation) is omitted, it is assumed to have the value “0” as long as the time scale component accepts the value “0” (
‘1985Y4M15DT15H0M10S’ and ‘1985Y4M15DT15H10S’ can be both used to express the time 3:00:10 p.m. on April 15th, 1985 in the Gregorian calendar.
‘1988Y3M1DT2H0M0S’ and ‘1988Y3M1DT2H’ are unequal representations where the former expression has seconds precision, and the latter expression has hour precision.
‘2018Y8M8DT30M0SZ’: indicates the date 8th August 2018 at time 00:30:00 in UTC time of day Since the “hour” component is omitted and “seconds” included, the hour is assumed to be zero, and the expression has seconds precision. This is equivalent to the expression ‘2018Y08M08DT30M0SZ’ in which zero padding is applied to calendar month and calendar day.
The lowest denoted time scale component in a date and time representation indicates the precision level of the representation.
‘1985Y4M’ has calendar month precision.
‘1985Y4M12DT2H’ has clock hour precision.
‘1985Y4M12DT30M’ has clock minute precision, where the clock hour time scale component is a zero-valued omission.
A decimal fraction of hour, minute or second may be included in an expression in accordance with
‘2018Y8M8DT0,5H’: indicates the date 8th August 2018 at time 00:30 with minutes precision.
‘2018Y8M8DT10H30.5M’: indicates the date 8th August 2018 at time 10:30:30 with seconds precision.
‘2018Y8M8DT10H30M15,3S’: indicates the date 8th August 2018 at time 10:30:15 plus 300ms with sub-second precision.
Any of the representations given in this clause may be modified for reduced precision
(
‘2018Y8M’: indicates the date August 2018 with calendar month precision.
‘2018Y8M8DT30M’: indicates the date 8th August 2018 at time 00:30 with minute precision. Since the “hour” component is omitted, it is assumed to be zero because it is of a higher order than the lowest order component specified in the representation (here, “minutes). The omitted “`second” component does not form part of the representation because it is of a lower order than the lowest order component.
A time interval shall be expressed by a start and an end date. A solidus [“/”] is used as a separator to separate the two start and end dates.
The complete representation of a time interval is defined as follows.
‘1985Y4M12DT23H20M50S/1985Y6M25DT10H30M0S’, time interval beginning at 20 minutes and 50 seconds past 23 hours on 12 April 1985 local time of day and ending at 30 minutes past 10 hours on 25 June 1985 local time of day.
Providing a duration as an alternative to either a start or end date is acceptable, given the start and end dates can be inferred from the given duration of the time interval.
‘1985Y4M12DT23H20M50S/P3D’
‘P3D/1985Y4M12DT23H20M50S’
For expression of a time interval by a start and an end, higher order time scale components may be omitted from the “end of time interval”, provided that the resulting expression is unambiguous. In this case the omitted higher order components from the “start of time interval” expression apply.
‘2018Y1M15D/2M20D’ represents ‘2018Y1M15D/2018Y2M20D’ as the expression ‘2M20D’ unambiguously refers to the calendar month and calendar day components, and the higher order components can be inherited from the start date expression.
Representations for time zones and UTC included with the component preceding the separator shall be assumed to apply to the component following the separator, unless a corresponding alternative is included.
‘2018Y1M15DZ5Y0M/2018Y2M20D’ is equivalent to ‘2018Y1M15DZ5Y0M/2018Y2M20DZ5Y0M’ as the ‘Z5H0M’ time shift also applies to the expression after the separator.
Duration can be expressed by a combination of time scale units in explicit form — years, months, weeks, days, hours, minutes, and seconds.
These time scale components are specified in
Time scale unit components are used to compose a duration expression, and are defined as “durational units”.
The following time scale components can be combined to form a representation denoted as [durationUnits] for the expression of duration.
Where,
each time scale component acting as a durational unit (such as [monthE]) may be omitted;
the time designator symbol [“T”] is used to separate the time scale components relating to the clock from those of the calendar.
Within [durationUnits], time scale components of higher order shall be expressed before those of lower order.
The following representations are both considered complete representations of duration.
The composite representation of a duration, fully accepting
expressions of the duration representation given in
Where,
[durationUnits] contains time scale components for expressing positive duration.
‘P3D’, duration of three days.
‘P3W2D’, duration of three weeks and two days, which is 23 days, as equivalent to the expression of ‘P23D’.
‘P180Y800D’, duration of one-hundred-and-eighty years and eight-hundred days.
The exact duration for some time scale components can only be known when placed on the actual time scale.
The precedence representation of a duration is used for specifying author intent in the evaluation order of time scale components within a duration.
The representation of calendar duration time scale components (denoted as [calendarD]) is provided as follows.
Where,
[calendarDU] is one of [yearE], [monthE], [weekE], [dayE].
P3D describes a duration of three days, in accordance with [calendarD].
The representation of clock duration time scale components (denoted as [clockD]) is provided as follows.
Where,
[clockDU] is one of [hourE], [minuteE], [secondE].
PT8H describes a duration of eight hours, in accordance with [clockD].
The duration precedence representation is described as follows, denoted as [durationP].
Where,
[durC-i] is either [calendarD] or [clockD];
the order of the [durC-i] components is used to determine the evaluation precedence order of the duration statement [durationP].
P1YP3MP2D describes a duration of one year, three months and two days, to be evaluated in the order as described.
P2DP3MP1Y describes a duration of two days, three months and one year, to be evaluated in the order as described.
PT10HP2DP3MP1Y describes a duration of ten hours, two days, three months and one year, to be evaluated in the order as described.
A duration with a negative value represents a duration in the reverse direction of the proceeding time scale.
-P20Y3M describes a negative duration of twenty years and three months ago.
-P2DP3MP1Y describes a negative duration of two days, three months and one year, to be evaluated in the order as described.
A duration representation can be modified to accept a fractional value in place of any [i] specified in a durational time scale component.
This clause describes methods to resolve exact duration in face of ambiguities.
The exact duration of some time scale units can only be known when placed on the actual time scale.
‘P1Y’ duration could be 365 or 366 calendar days depending on whether the year is a leap year.
‘P3M’ duration could be 90, 91, 92 days depending on the actual calendar months and calendar year.
‘PT1M’ duration is normally 60 seconds, but when the minute is the last minute of the year, it could be 59, 60 or 61 seconds long depending on whether a leap second is applied.
‘P1Y2M15DT12H30M’, duration of 1 year, 2 months, 15 days, 12 hours and 30 minutes. The actual duration of the involved calendar months can only be known when the duration is placed on an actual start date.
The exact duration of certain time scale unit may only be known after an event occurs.
There is no universal rule to calculate leap seconds in advance, since the decision to insert a leap second is driven by a number of dynamic factors and only known when announced by the BIPM.
Specifically, the exact duration of the last clock minute of a calendar year can only be known after it is announced by the BIPM, whether a leap second has or will occur (in UTC). This event is described in this document to occur at the “leap second horizon date” for a calendar year.
The exact duration of the last clock minute in a calendar year is one of the following duration:
when there is a positive leap second, 61 clock seconds;
when there is no leap second, 60 clock seconds; and
when there is a negative leap second, 59 clock seconds.
For the accuracy of general purposes, it is acceptable to assume the last clock minute always contains 60 clock seconds, just like any other clock minute.
For cases where durational accuracy at the clock second level is of importance, the following steps shall be taken:
When calculating exact duration prior to the leap second horizon date of a specific calendar year involved, the last clock minute is assumed to have no leap second, such that 59 is always the last second of the year;
When calculating exact duration after the leap second horizon date of a specific calendar year involved, the last clock minute shall reflect the actual duration.
‘P3000Y12M31DT23H59M’ is considered to have a duration of 60 clock seconds, as the calendar year 3000’s leap second horizon date has not yet occurred.
‘P2016Y12M31DT23H59M’ is considered to have a duration of 61 clock seconds, since the leap second horizon date has already occurred, and it is known that a positive leap second assigned to the calendar year 2016.
A date and time representation is modified by a duration in many cases, including the calculation for:
time intervals when given duration as a start or end;
boundaries of grouped time scale units (
conversion between of UTC of day and local time of day via time shifts; and
occurrences of recurring time intervals.
This clause provides methods to calculate a consistent result date and time, given an origin date and time (“origin”) and a duration time scale component (duration) to apply.
Modification of a date and time representation with a duration is described using the following representation, called a “date time formula”.
or
2018Y9M10D + P1D is a date time formula.
An “overflow” of a date and time expression is defined as assigning a value exceeding the maximum value accepted by the time scale component.
An increase of P1M (duration) to 2018Y12M (date) will result in the expression 2018Y13M, where the month component is overflowed with value 13.
An overflow is considered resolved once the overflowed time scale unit has transferred its excess to the immediate higher order time scale component.
The overflowed expression 2018Y13M can be resolved to 2019Y1M.
An overflow can cause multiple carry-overs when the overflow not only causes the immediate higher order time scale component to overflow, but also subsequent higher order components.
The overflowed expression 2018Y12M366D can be resolved to 2018Y24M1D (which still contains an overflow), which can be resolved to 2019Y12M1D (where there is no more overflow).
A modification made to a higher order time scale component may cause the value of a lower order time scale component to go beyond its value boundaries. This condition is described as “out of bounds” of a date and time expression.
This situation occurs when a modification is made to the values of certain time scale components, because a lower order component always has its maximum value bound by its immediate higher order component:
clock minute (clock second value of 60 is only valid for a leap second);
calendar month (calendar day values 29, 30, 31 are invalid for some months); and
calendar year (ordinal day value of 366 and calendar month/day combination of February 29th is only valid for a leap year).
An increase of P1M (duration) to 2018Y1M31D (date) will result in the expression 2018Y2M31D, which is an invalid date representation as the calendar day value of 31 has exceeded the boundary of its immediate higher order component, the month 2 (February).
An increase of P1Y (duration) to 2016Y12M31DT23H59M60S (date) will result in the expression 2017Y12M31DT23H59M60S, which is an invalid date representation as the clock second value of 60 has exceeded the boundary of its immediate higher order component, the clock minute with its last second at 59.
An out of bounds situation is considered resolved once the excess value is truncated at the violating (lower order) time scale component.
The out of bounds expression 2019Y2M29D`" can be truncated to `2019Y2M28D.
The out of bounds expression 2020Y366O`" can be truncated to `2020Y365O.
A simple duration is a duration expression with only a single time scale component.
Evaluation of a date time formula that contains a simple duration is to directly apply the durational unit to the corresponding time scale component of the date and time representation and applying carry-over.
The steps are as follows:
Take the value of the time scale component in the simple duration, directly modify the value of the corresponding time scale component in the date and time representation.
In the resulting date and time representation, start from the lowest order overflowed time scale component, perform carry-over until there is no more overflow in the representation.
If any time scale components have become invalid, apply truncation to them.
The resulting date and time representation is complete.
Calculation of 2022Y2M28D + P3D:
Direct modification of date and time representation, obtains 2022Y2M31D.
Apply carry-over to overflowed components, obtains 2022Y3M02D.
The method of evaluating of a date time formula with a
composite duration (
The steps are as follows:
For all values of time scale components in the composite duration, directly modify the values of the corresponding time scale components in the date and time representation.
In the resulting date and time representation, start from the lowest order overflowed time scale component, perform carry-over on all overflowed time scale components, until there is no more overflow in the representation.
If any time scale components have become invalid, apply truncation to them.
The resulting date and time representation is complete.
Calculation of 2022Y2M30D + P1Y3M2D:
Direct modification of date and time representation, obtains 2023Y5M32D.
Apply carry-over to overflowed components, obtains 2023Y6M31D.
The resulting representation is 2023Y6M31D.
The method of evaluating of a date time formula with a
precedence duration (
The steps are as follows:
Starting at the left side of the precedence duration expression, process every durational unit one by one as follows:
Use the durational unit (which only contains one time scale component), to modify the corresponding time scale component (the “target component”) in the date and time representation.
If the target component has overflowed in the previous step, perform carry-over (to higher order time scale components), until there is no more overflow in the representation.
If any time scale components of lower order than the target component have become invalid, apply truncation to them.
Once all durational units have been processed, the resulting date and time representation is complete.
Calculation of 2022Y2M29D + P1YP3MP2D:
Process the first durational unit: (2022Y2M29D + P1Y) + P3MP2D.
Apply the first durational unit to the date and time representation: 2023Y2M29D + P3MP2D.
No carry-over is necessary since there is no overflow.
Since 29D is of lower order than the target component (calendar year), the representation is truncated: 2023Y2M28D + P3MP2D.
Process the second durational unit: (2023Y2M28D + P3M) + P2D.
Apply the second durational unit to the date and time representation: 2023Y5M28D + P2D.
No carry-over is necessary since there is no overflow.
No component of lower order than the target component is invalid, hence truncation is not necessary.
Process the third durational unit: 2023Y5M28D + P2D.
Apply the third durational unit to the date and time representation: 2023Y5M31D.
No carry-over is necessary since there is no overflow.
No component of lower order than the target component is invalid, hence truncation is not necessary.
The resulting date and time representation is 2023Y5M31D.
Calculation of 2022Y2M29D + P2DP3MP1Y:
Process the first durational unit: (2022Y2M29D + P2D) + P3MP1Y.
Apply the first durational unit to the date and time representation: 2022Y2M31D + P3MP1Y.
Carry-over is necessary since there is the target component has overflowed: 2022Y3M2D + P3MP1Y.
No component of lower order than the target component is invalid, hence truncation is not necessary.
Process the second durational unit: (2022Y3M2D + P3M) + P1Y.
Apply the second durational unit to the date and time representation: 2022Y6M2D + P1Y.
No carry-over is necessary since there is no overflow.
No component of lower order than the target component is invalid, hence truncation is not necessary.
Process the third durational unit: 2022Y6M2D + P1Y.
Apply the third durational unit to the date and time representation: 2023Y6M2D.
No carry-over is necessary since there is no overflow.
No component of lower order than the target component is invalid, hence truncation is not necessary.
The resulting date and time representation is P1Y.
When fractional duration (
The expression P0.5M (“half a month”) is ambiguous because the exact duration of a calendar month depends on its context, and that the context for which P0.5M is anchored to is unclear.
The duration of a fractional, context-dependent, durational unit can be obtained by first calculating a single unit of the durational unit in context, such that, the exact duration for the durational unit in whole (e.g. “P1M”) becomes known. Once the exact duration of a single unit is known, the duration of the fractional unit can be calculated.
Where,
unit(frac-dur) is the value of a single unit used in the duration frac-dur;
value(frac-dur) is the fractional value used with the duration frac-dur;
duration(date1, date2) is a function to calculate the duration between two dates or times,
such as
Given that “date + unit(frac-dur)” can be calculated, this method always produces a consistent value.
Given the expression: 2018-01-23 + P0.5M:
It is rephrased as duration(2018-01-23 + P1M, 2018-01-23) × 0.5 + 2018-01-23.
It is reduced to duration(2018-02-23, 2018-01-23).
Then P31D × 0.5 + 2018-01-23.
Then P15.5D + 2018-01-23.
Since P15.5D is an exact duration (duration of calendar day is known), P15.5D + 2018-01-23`" is resolvable and gives the final result `2018-02-07T12:00:00.
As described in
The rules specified in
This example applies identically with or without a leap second. Given the expression: 2018-12-31T23:59:59 + PT1M:
Apply the durational unit clock minute directly to the representation: 2018-12-31T23:60:59
Since 59 is the last clock minute, treat the overflow with carry-over: 2018-12-31T24:00:59
Since 23 is the last clock hour, treat the overflow with carry-over: 2018-12-32T00:00:59
Since 31 is the last calendar day of year, treat the overflow with carry-over: 2018-13-01T00:00:59
Since 13 is the last calendar month, treat the overflow with carry-over: 2019-01-01T00:00:59
The resulting expression is 2019-01-01T00:00:59.
Given the expression containing a leap second: 2016-12-31T23:59:60 + PT1M:
Apply the durational unit clock minute directly to the representation: 2016-12-31T23:60:60
Since 59 is the last clock minute, treat the overflow with carry-over: 2016-12-31T24:00:60
Since 23 is the last clock hour, treat the overflow with carry-over: 2016-12-32T00:00:60
Since 31 is the last calendar day of year, treat the overflow with carry-over: 2016-13-01T00:00:60
Since 13 is the last calendar month, treat the overflow with carry-over: 2017-01-01T00:00:60
The clock second 60 is out of bounds, it is truncated to the maximum value: 2017-01-01T00:00:59
The resulting expression is 2017-01-01T00:00:59.
Given the expression containing a leap second: 2016-12-31T23:59:59 + PT1S:
Apply the durational unit clock second directly to the representation: 2016-12-31T23:59:60
The resulting expression is 2016-12-31T23:59:60.
The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.