In general a time specification accepts most ISO8601 formats in addition to a number of auxiliary formats.
- The literal
now
-
The current time.
- An infinite bound
-
This is one of the following forms:
- Empty
-
All space or zero length.
0
-
The number zero.
none
undef
orundefined
inf
orinfinity
all
forever
- An integer and an offset multiplier
-
This offsets the time in the other reference point. It is only valid when a reference point exists, such as valid other bound in a pair of times. The form is of "X<unit>" where "X" is a non-negative number, and "<unit>" is one of:
msec
ormilliseconds
s
,sec
, orseconds
m
,min
, orminutes
-
Exactly X * 60 seconds.
h
orhours
-
Exactly X * 3600 seconds.
d
ordays
-
Exactly X * 86400 seconds.
w
orweeks
-
Exactly X * 604800 seconds.
mo
,mon
, ormonths
-
Preserves the time of day and day of month.
q
,qtr
, orquarter
-
Preserves the time after the start of the quarter.
y
oryears
-
Preserves the month, day of month, and time of day.
Example 1. One week from the reference point1w
The offset may also also be followed by
a
oraligned
to align to the boundary the multiplier represents.Example 2. Rounding to the quarter boundary0qa
In general the count must be an integer. However, decimal numbers are accepted for the exact fixed length specifications and are interpreted as the largest whole unit below the specification that gives the exact time.
Example 3. 36 hours as a number of days1.5d
Alignment is not allowed on fractional specifications. Without the alignment enabled, the count number must be positive (non-zero). If the count is omitted then the specification is for a single of the unit.
- Date and/or time
-
If present the date must come first. The date must start with a four digit year, followed by an optional month and day of month. Each field must be separated by either a dash or a slash. The time then follows either a space separator or a
T
. Time is specified on a 24 hour clock, with the hours first, seconds being optional. Each field must be separated by a:
. The specification may optionally end in aZ
.Example 4. ISO8601 specification2010-03-10T00:15:00Z
Example 5. Excel-like specification2010/03/10 00:15:00
Example 6. Date only2010-03-10
Example 7. Date and time without delimiters20100310T001500Z
Example 8. Time only15:00:12.123Z
Example 9. Year only2010
If only a time is specified, the date is inferred from the reference point such that it would be reasonable relative to it.
Example 10. Data inferenceIf the this is the start bound and the time is after the reference end bound, then it is assumed to be in the prior day
A date and/or time may optionally be followed by a time zone offset. This takes the form of plus or minus and a two or four digit integer or
hh:mm
. This number is subtracted or added to the given time to give UTC. - Year and week or week
-
One of the following forms:
- YYYYwWW
- YYYYwWW-D
-
Monday is day one.
- wWW
- wWW-D
-
Monday is day one.
Note that the "WW" component may be a single digit. The exact time that the week specifies depends on the reference point: if this is a start bound, then time specified is the start of that week, otherwise it is the end. If the year is omitted then it is inferred from the reference point as with only a time above.
- Year and quarter or quarter
-
One of the following forms:
- YYYYqQ
The exact time that the quarter specifies depends on the reference point as above with weeks.
- Year and DOY or DOY
-
A four digit year separated from a DOY by any of
:
,;
,,
or space(s). The day of year starts with 1.0 being midnight January 1st of that year. The separator may also be omitted or replaced with-
if there are exactly three digits in the integer component of the DOY. If the DOY has exactly two decimal digits, it is assumed to specify an hour and rounded to the nearest hour boundary.Example 11. Midnight January 1st, 20102010:1
Example 12. 0600 January 2nd, 20102010,1.25
Example 13. 1200 January 23, 20102010;023.5000
2010023.5000
Example 14. Midnight January 27, 20102010-027
The year may also be omitted in which case it is inferred from the reference point.
- A fractional year
-
This is a number with a fractional component between 1900.0 and 2999.0. The integer part is interpreted as a year and the fractional part is the fraction of the way through the year.
Example 15. Fractional year at 2010-01-01T00:00:00Z2010.0
Example 16. Fractional year at 2010-07-02T12:00:00Z2010.5
- An epoch time
-
This is a decimal number of seconds since 1900-01-01T00:00:00Z. This may also be begun with
E:
to disambiguate from ISO time strings.The time specification may be followed by an offset, this consists of a plus or minus, an integer, and a unit. The integer number of the given time unit are added or subtracted to the time specified before. The following time units are valid:
msec
ormilliseconds
s
,sec
, orseconds
m
,min
, orminutes
-
Exactly X * 60 seconds.
h
orhours
-
Exactly X * 3600 seconds.
d
ordays
-
Exactly X * 86400 seconds.
w
orweeks
-
Exactly X * 604800 seconds.
mo
,mon
, ormonths
-
Preserves the time of day and day of month.
q
,qtr
, orquarter
-
Preserves the time after the start of the quarter.
y
oryears
-
Preserves the month, day of month, and time of day.
Example 17. Five day offset2010-03-10T00:15:00Z+5d is equivalent to 2010-03-15T00:15:00Z.
NoteOverflowWhen the alignment would overflow a date field it is set to the largest valid one in the alignment. So one month up from Mar 31 would be on Apr 30.