# Time Domain

Time Domain is a specification for string-valued attributes or properties to specify date and time intervals during which certain condition or restriction applies. Time Domain is part of the GDF (Geographic Data Files) specification which is an ISO standard. The current standard is GDF 5.1 which is ISO 20524-1:2020.

This guide covers:

## Time Domain Basic Concepts

### Time Domain Syntax

Time Domain concepts and syntax are explained in detail in the following sections, but we'll start with a simple example:

• A basic Time Domain is the combination of a Starting Time and a Time Duration with the following notation: (Starting Time) {Time Duration}. For example, (M5d1){d1} means:
• Starting Time: (M5d1) - any year, month 5 (May), day 1st, at 0:00 a.m.
• Duration: {d1} - 1 complete day (i.e., 24 hours or 1440 minutes).

Putting this together we get: "May 1st of every year, for the entire day"

### Starting Time Syntax

In basic time domain notation (Starting Time) {Time Duration}, Starting Time describes a time at the granularity of years, months, weeks, days, hours, minutes, and/or seconds. The elements must be ordered starting with the longest time unit (years) decreasing towards the smallest (seconds). The following table lists all time unit types, their notation and allowed values:

Type Notation Value Domain Description
Year ynnnn nnnn=0...9999 nnnn defines a particular year.
Example: (y1985) means the year 1985. Precisely, if no more information is available it means 1 January 1985 at 0:00:00 a.m. Refer to General Rule for Default Values below for details about default values of omitted units.
Month Mnn nn=1...12 nn defines a particular month within a particular year, or any year when no “y” information is given. Value domain 1...12 means January...December.
Example: (M5) means every May 1st at 0:00:00 a.m. every year, whereas (y1985M5) means May 1st at 0:00:00 a.m. in 1985.
Week wnn nn=1..53 nn defines a particular week (week 1 to week 53) within a particular year, or any year when no “y” information is given.
Example: (w5) means 5th week (week starts from Sunday) Sunday at 0:00:00 a.m. every year, whereas (y1985w5) means 5th week Sunday at 0:00:00 a.m. in 1985.
Day dnn nn=1...28,29,30,31 nn defines a particular day within a particular month, or any month when no "M" information is given.
Example: (d10) means the tenth day in any month of any year at 0:00:00 a.m., whereas (y1985M5d10) means 10th May 1985 at 0:00:00 a.m.
tn n=1...7 n defines a particular day of the week, within a particular week, or any week when no "w", "M", or "y" information is given. Value domain 1...7 means 1: Sunday, 2: Monday, ..., 7: Saturday.
Example: (t2) means Monday of every week of every month of every year, whereas (M5t2) means each Monday in May (5th Month) of every year, and (w5t2) means Monday of the 5th week of every year.
fxn x=1...5, n=1..7 Defines a particular day of the week, in a particular month, where n is used as in the "tn" format (i.e. 1: Sunday, ..., 7: Saturday) and x is "1: first", "2: second", ..., "5: fifth".
Example: (f12) means the first Monday at 0:00:00 a.m. of every month of every year, whereas (M5f12) means the first Monday of May at 0:00:00 a.m. of every year.
lxn x=1...5, n=1..7 Defines a particular day of the week, in a particular month, where n is used as in the "tn" format (i.e. 1: Sunday, ..., 7: Saturday) and x is "1: first", "2: second", ..., "5: fifth". Values for x are given in reverse order starting from the end of the month and have the meaning: "1=last", "2=second-to-last", "3=third-to-last", etc.
Example: (l12) means the last Monday at 0:00:00 a.m. of every month of every year, whereas (y1985l12) means the last Monday at 0:00:00 a.m. of every month in 1985.
Hour hnn nn=0...23 nn defines a particular hour in a particular day, or any day when no "d", "M", or "y" information is given.
Example: (h6) means every day of every month of every year at 6:00 a.m., whereas (d10h6) means every 10th day at 6:00:00 a.m. of every month of every year.
Minute mnn nn=0...59 nn defines a particular minute in a particular hour, or any hour when no "h", "d", "M", or "y" information is given.
Example: (m24) means the 24th minute of every hour of every day of every month of every year, whereas (d10h6m24) means every 10th day at 6:24:00 a.m., of every month of every year.
Second snn nn=1...59 nn defines a particular second in a particular minute, or any minute when no "m", "h", "d", "M", or "y" information is given.
Example: (s15) means the 15th second of every minute of every hour of every day of every month of every year, whereas (d10h6m24s15) means every 10th day of every month at 6:24:15 a.m., on every year.

#### General Rule for Default Values:

To find the default value for a particular time unit that is undefined in a Starting Time sequence, a distinction has to be made whether the missing time type code is a final one or not.

Final time type codes:

For all time type codes that are missing at the end of a sequence---that is, if the smaller time ranges are missing---the default value is the lowest possible value (i.e., M1, w1, d1, h0, m0, s0). If no “Day” is specified (i.e., none of the “d,t,f,l” formats are used) within a defined year and/or month, the default time code and the default value is d1.

Other time type codes:

If time type codes are missing at the beginning of a sequence, or between defined time units, this means that the specification is valid for all possible values of the missing types.

Examples for default values of undefined time units in Starting Time:

• (y1994t1): year 1994, any month/any week, each Sunday (t1), time 00:00:00 a.m.
• (w9h11m30): ninth week of any year, any day in this week, 11:30 a.m., 0 seconds
• (M4): any year, 1 April, time 00:00:00 a.m.
• (M4m33): any year, April, any day of April, any hour at 33 minutes and 0 seconds

Figure: Valid term combination for Starting Time.

### Time Duration Syntax

Time Duration is defined by terms representing the time interval units: year, month, week, day, hour, minute and second.

A single Time Duration specification is defined by an interval type code indicating a particular time interval unit (e.g., y for year, s for second, etc.), and up to 2 digits for the time interval values (e.g. {ynn} as in {y11}). If the very first time type code is preceded by a minus (-) sign, it means that the duration is counted backwards from the starting time (e.g. {-snn} as in {-s87}). If the minus (-) sign preceeds any other time type code other than the first, it deducts the amount of time represented by those terms from the entire duration (see examples below in the Combination of periods section). The following table lists the time interval unit types, their notation, allowed values and substitutions:

Type Notation Value Domain Substitutions Description
Year ynn nn=1...99 Defines a duration of nn years.
Example: (y1991M11d14h5m30s19) {y1} means from 14 November 1991, 5:30:19 a.m. to 14 November 1992, 5:30:19 a.m. .
Note: In the particular case of 29 February, if the yearly duration leads to a non-leap year, this results on 28 February of that year.
Month Mnn nn=1...99 {M12} = {y1} Defines a duration of nn months.
Example: (y1991M11d14h5m30s19) {M3} means from 14 November 1991, 5:30:19 a.m. to 14 February 1992, 5:30:19 a.m.
Week wnn nn=1...99 Defines a duration of nn weeks, i.e. nn7 days.
Example:* (y1991M11d14h5m30s19) {w2} means from 14 November 1991 at 5:30:19 a.m. to 28 November 1991, 5:30:19 a.m.
Day dnn nn=1...99 {d7} = {w1} Defines a duration of nn days, i.e. nn24 hours.
Example:* (y1991M11d14h5m30s19) {d2} means from 14 November 1991 at 5:30:19 a.m. to 16 November 1991, 5:30:19 a.m.
Hour hnn nn=1...99 {h24} = {d1} Defines a duration of nn hours, i.e. nn60 minutes.
Example:* (y1991M11d14h5m30s19) {h10} means from 14 November 1991, 5:30:19 a.m. to 14 November 1991 at 3:30:19 p.m.
Minute mnn nn=1...99 {m60} = {h1} Defines a duration of nn minutes, i.e. nn60 seconds.
Example:* (y1991M11d14h5m30s19) {m11} means from 14 November 1991 at 5:30:19 a.m. to 14 November 1991 at 5:41:19 a.m.
Second snn nn=1...99 {s60} = {m1} Defines a duration of nn seconds.
Example: (y1991M11d14h5m30s19) {s21} means from 14 November 1991 at 5:30:19 a.m. to 14 November 1991 at 5:30:40 a.m.

#### Default Values

The default value for each missing time type value in a sequence of basic Time Durations is 0 (zero).

#### Combination of periods

Time periods which are composed of multiple time duration units are represented by listing the individual terms sequentially in hierarchical order, similarly to Starting Time.

The total time duration of a combination of terms is the sum of all single Time Durations, e.g.:

• {y2M1w2} means a period of 2 years, 1 month and 2 weeks.
• {y2-M1w2} means a period of 2 years, take away 1 month and then add 2 weeks.
• {y2-M1-w2} means a period of 2 years, take away 1 month and then take away (additionally) 2 weeks. Note that the final 2 weeks subtraction isn't from the 1 month term, but from the entire cummulative term.

NOTE: Without a (Starting Time), {Time Duration} just indicates a duration, not a Time Domain i.e. {h11} just indicates "a duration of 11 hours" which is not linked to any specific date, period, or point in time, but (M5){h11} indicates "From 0:00:00 a.m. to 11:00 a.m. on May 1st, every year". A condition or restriction cannot be applied for a period of 11 hours without knowing when to start.

## Time Domain Basic Examples

TIme Domain Description
(y1994t1) Year 1994, any month/any week, every Sunday (t1), at 00:00:00 a.m.
(w9h11m30) Ninth week of any year, any day in this week, at 11:30:0 a.m.
(h9){h4} From 9 a.m. to 1 p.m. every day, every month, every year
(M3t6h19m30){h2m30} From 19:30 to 22:00 every Friday in March, every year
(h9){h4} or (h13){-h4} or (h13)-{h4} From 9am to 1pm every day, every year

### Time Domain Combination

Time Domains can be considered as a set of the smallest time unit, the second, and can be combined with set operations, such as:

• Set Intersection with notation "*"
• Set Union with notation "+"
• Set Substraction with notation "-"

A complex Time Domain can be used to define complicated intervals involving unions, intersections, exclusions, etc. For example, -+(h9){h3}(h13m30){h5m30}(t1){d1} means "From 9:00 a.m. to 12:00 a.m. and From 13:30 to 19:00, every day, except Sundays":

• (h9){h3}: start at hour 9 (h9) for a duration of 3 hours {h3} i.e. From 9:00 a.m. to 12:00 a.m.
• + (h13m30){h5m30}: and (+), start at 13 hours 30 minutes (h13m30) for a duration of 5 hours 30 minutes {h5m30} i.e. From 13:30 to 19:00.
• - (t1){d1}: except (-), 1st day of week (t1) for entire day {d1} i.e. except Sundays.

Example 01

(y1992){-m5}

Last 5 minutes before the start of 1992.

Example 02

-+(h9m30){h5m30}(h16m30){h4m30}(M6){M4}

Every day from 9:30 to 15:00 and 16:30 to 21:00, excluding the months June through September.

Explanation:

• -+(h9m30){h5m30}(h16m30){h4m30}(M6){M4} : 5 hours 30 minutes from 9:30 i.e. From 9:30 to 15:00

• -+(h9m30){h5m30}(h16m30){h4m30}(M6){M4} : 4 hours 30 minutes from 16:30 i.e. From 16:30 to 21:00

• -+(h9m30){h5m30}(h16m30){h4m30}(M6){M4} : 4 months from June (6th Month) i.e From June through September.

Example 03

-+*(t2){d5}(h8m10){m35}+*(t2){d5}(h12m15){m35}+*(t2){d5}(h13m30){m40}*(t2){d5}(h16){m40}(M7d2){d1}

Every Monday to Friday from 8:10 to 8:45, 12:15 to 12:50, 13:30 to 14:10 and 16:00 to 16:40 other than 2nd July

Explanation:

• -+*(t2){d5}(h8m10){m35}+*(t2){d5}(h12m15){m35}+*(t2){d5}(h13m30){m40}*(t2){d5}(h16){m40}(M7d2){d1} : From Monday (2nd day of week) for 5 days i.e Monday to Friday.

• -+*(t2){d5}(h8m10){m35}+*(t2){d5}(h12m15){m35}+*(t2){d5}(h13m30){m40}*(t2){d5}(h16){m40}(M7d2){d1} : 35 minutes duration from 8:10 i.e. 8:10 to 8:45

• -+*(t2){d5}(h8m10){m35}+*(t2){d5}(h12m15){m35}+*(t2){d5}(h13m30){m40}*(t2){d5}(h16){m40}(M7d2){d1} : 12:15 to 12:50

• -+*(t2){d5}(h8m10){m35}+*(t2){d5}(h12m15){m35}+*(t2){d5}(h13m30){m40}*(t2){d5}(h16){m40}(M7d2){d1} : 13:30 to 14:10

• -+*(t2){d5}(h8m10){m35}+*(t2){d5}(h12m15){m35}+*(t2){d5}(h13m30){m40}*(t2){d5}(h16){m40}(M7d2){d1} : 16:00 to 16:40

• -+*(t2){d5}(h8m10){m35}+*(t2){d5}(h12m15){m35}+*(t2){d5}(h13m30){m40}*(t2){d5}(h16){m40}(M7d2){d1} : 2 day of July (7th Month) for a duration of 1 day i.e 2nd July

Example 04

*(M2l11h2){M8}(M9f36h2){-M8}

Every year from the last Sunday of February at 2 a.m. to the third Friday of September at 2 a.m.

Explanation:

• *(M2l11h2){M8}(M9f36h2){-M8} : Eight months starting from the last Sunday of February at 2 a.m.

• *(M2l11h2){M8}(M9f36h2){-M8} : Eight months before the third Friday of September at 2 a.m.

Example 05

*(M9f17h22){M8}(M4f17h22){-M8}

Every year from the first Saturday of Septemper at 22:00 to first Saturday of April at 22:00 of the next year

Explanation:

• *(M9f17h22){M8}(M4f17h22){-M8} : Eight months starting from the first Saturday of Septemper at 22:00

• *(M9f17h22){M8}(M4f17h22){-M8} : Eight months before the first Saturday of April at 22:00

Example 06

-(M10d10h8){M5}(M3d10h8){-d9}

Every year from 10 October at 8 a.m. to 1 March at 8 a.m. next year.

Explanation:

• -(M10d10h8){M5}(M3d10h8){-d9}: From 10 October at 8 a.m. to 10 March at 8 a.m.

• -(M10d10h8){M5}(M3d10h8){-d9}: Nine days before 10 March at 8 a.m.

Example 07

---*+(h9){h3}(h13m30){h5m30}(t2){d6}(M5d1){d1}(M1l13){d1}(M8){M1}

From 9:00 a.m. to 12:00 p.m. plus from 13:30 to 19:00 each day from Monday to Saturday, except each 1st of May, last Tuesday of January, and during all of August

Explanation:

• ---*+(h9){h3}(h13m30){h5m30}(t2){d6}(M5d1){d1}(M1l13){d1}(M8){M1} : From 9:00 a.m. to 12:00 p.m.

• ---*+(h9){h3}(h13m30){h5m30}(t2){d6}(M5d1){d1}(M1l13){d1}(M8){M1} : From 13:30 to 19:00

• ---*+(h9){h3}(h13m30){h5m30}(t2){d6}(M5d1){d1}(M1l13){d1}(M8){M1} : 6 days duration from Monday i.e. Monday to Saturday

• ---*+(h9){h3}(h13m30){h5m30}(t2){d6}(M5d1){d1}(M1l13){d1}(M8){M1} : 1st of May

• ---*+(h9){h3}(h13m30){h5m30}(t2){d6}(M5d1){d1}(M1l13){d1}(M8){M1} : Last Tuesday of January

• ---*+(h9){h3}(h13m30){h5m30}(t2){d6}(M5d1){d1}(M1l13){d1}(M8){M1} : All of August

Example 08

-*(t2){d5}(h16){h1}(M7){M2}

Every year, every week, from Monday to Friday, from 16:00 to 17:00, except July and August

Explanation:

• -*(t2){d5}(h16){h1}(M7){M2} : 5 days duration from Monday i.e. Monday to Friday

• -*(t2){d5}(h16){h1}(M7){M2} : From 16:00 to 17:00

• -*(t2){d5}(h16){h1}(M7){M2} : 2 months duration from July i.e. July and August

Example 09

-+*(t2){d6}(h8){m45}*(t2){d6}(h16m15){m45}(M7){M2}

Every year, every week from Monday to Saturday, from 8:00 a.m. to 8:45 a.m., 16:15 to 17:00 except July and August

Explanation:

• -+*(t2){d6}(h8){m45}*(t2){d6}(h16m15){m45}(M7){M2} : Monday to Saturday

• -+*(t2){d6}(h8){m45}*(t2){d6}(h16m15){m45}(M7){M2} : From 8:00 a.m. to 8:45 a.m.

• -+*(t2){d6}(h8){m45}*(t2){d6}(h16m15){m45}(M7){M2} : From 16:15 to 17:00

• -+*(t2){d6}(h8){m45}*(t2){d6}(h16m15){m45}(M7){M2} : July and August

Example 10

-++*(t2){d4}(h15m45){m20}*(t2){d5}(h8m15){m20}*+(t3){d2}(t6){d1}(h13){m35}(M7){M2}

Every year, every week, Monday to Thursday from 15:45 to 14:05, Monday to Friday from 8:15 to 8:35, and Tuesday to Wednesday and Friday 13:00 to 13:35, except July and August.

or,

Every year, every week,

Monday, from 8:15 to 8:35 and from 15:45 to 14:05,

Tuesday and Wednesday, from 8:15 to 8:35, from 13:00 to 13:35, and from 15:45 to 14:05,

Thursday, from 8:15 to 8:35 and from 15:45 to 14:05,

Friday, from 8:15 to 8:35 and from 13:00 to 13:35,

except July and August.

Explanation:

• -++*(t2){d4}(h15m45){m20}*(t2){d5}(h8m15){m20}*+(t3){d2}(t6){d1}(h13){m35}(M7){M2}: Monday to Thursday from 15:45 to 14:05

• -++*(t2){d4}(h15m45){m20}*(t2){d5}(h8m15){m20}*+(t3){d2}(t6){d1}(h13){m35}(M7){M2}: Monday to Friday from 8:15 to 8:35

• -++*(t2){d4}(h15m45){m20}*(t2){d5}(h8m15){m20}*+(t3){d2}(t6){d1}(h13){m35}(M7){M2}: Tuesday to Wednesday and Friday 13:00 to 13:35

• -++*(t2){d4}(h15m45){m20}*(t2){d5}(h8m15){m20}*+(t3){d2}(t6){d1}(h13){m35}(M7){M2}: except July and August

### Space and Line Break in Time Domain Syntax

A time domain expression may contain any number of space and line break characters either side of its syntax elements '[', '(', ')','{','}',']', '-','+', '*', as well as the various time terms. Time terms themselves, as the inner elements, shall not be broken up.

Valid Syntax:

(M5d1){d1}

(M5 d1) {d1}

---*+
(h9){h3} (h13m30){h5m30} (t2){d6}
(M5d1){d1} (M1l13){d1} (M8){M1}


Invalid Syntax:

(M 5d1){d1}


## Time Domain Use-Cases

Refer to Time Domain Usage In Routing Services for details on how Time Domain is used in routing services to specify time periods for which certain conditions or restrictions apply or are valid.

## Time Domain Special Notations and Extensions

• The GDF 5.1 specfication (ISO 20524-1:2020) documents the Time Domain format in infix notation, whereas, routing services use the prefix notation. This results in certain differences in syntax as described below:

• Infix vs Prefix notation: | Infix | Prefix | |-------|--------| | [[(d1){w1}]-[(d3){d1}]] | -(d1){w1}(d3){d1} | | [[(d1){w1}]*[(d3){-w1}]] | *(d1){w1}(d3){-w1} | | [[[(t2){d5}]*[(h16){h1}]]-[(M7){M2}]] | -*(t2){d5}(h16){h1}(M7){M2} |

• In the infix notation [ and ] are mandatory, but in the prefix notation they are optional.

• Fuzzy Terms:

Here we provide a short description of fuzzy terms, refer to Time Domain Fuzzy Terms for detailed description of available fuzzy terms.

• The terms described in Starting Time Syntax are refered to as Starting Time sharp terms, and znn represents the Starting Time Fuzzy term within the preceding sharp time. Fuzzy terms numbered z0-z49 are valid Starting Time fuzzy terms.
• The terms described in Time Duration Syntax are refered to as Time Duration sharp terms and znnn represents the Time Duration Fuzzy term. Fuzzy terms numbered z50-z100 are valid Time Duration fuzzy terms.
• In Starting Time the znn term may be preceded by a minus sign (-znn); unlike for sharp time terms, the minus sign alters the term semantics from starts (or ends) at beginning of to starts (or ends) at end of (e.g. (M12-z15) means the end of peak hour in December in any year, whereas (-m30-z15) means 30 minutes before end of peak hour).
• In Time Duration the znnn term may be preceded by a minus sign (-znnn); unlike for sharp time terms, the minus sign alters the term semantics to become the complementary (e.g. {z55} means during Winter, whereas {-z55} means during non-Winter).
• Time intervals represented through the Time Domain format are always in the local time zone of the Segment.