#
GDF Time Domains

**xTour**,

**xMap**,

**xRoute**,

**xData**

### Characteristic

### Short description

GDF time domains are a possibility to **specify time intervals**. Their advantage is that multiple recurring intervals can be defined by only one string.
For a complete definition of the GDF time domain format please have a look at the ISO format specification.
Hereafter, only the features supported by the PTV xServer will be described.

### Use

GDF time domains are one option to specify a time interval. In the xTour service they can be used to model opening intervals, for example if a customer has the same office hours for multiple weekdays. Note that when using the GDF time domains in xTour, a planning horizon is required to limit the total number of intervals defined by the recurring intervals of the time domains. The planning horizon is also used to define the timezone of the GDF time domains.

In the xMap and xRoute services the GDF time domains are used to describe the validity period of time dependent features, see Feature Layer Basics.

### Detailed Consideration

#### Fully Supported syntax

Generally, a time domain is composed of a starting date and/or a time duration with the following notation: **[(Starting Date){Time duration}]**.

'[' and ']' are mandatory and exactly one of each shall be used to encase a basic time domain.

The following terms can be used to describe the desired time domain. Each of those terms is valid in the starting date block. Terms marked in the column "Can be used as duration" are also valid as time duration. In the case of acting as a time duration, all terms have possible values in the range 0...99.

Time term | Format | Values | Can be used as duration |
---|---|---|---|

Year | ynnnn | 1000...9999 | x |

Month | Mnn | 1...12 | x |

Week | wnn | 1...53 | x |

Day (in a month) | dnn | 1...28/29/30/31 | x |

Day of the week | tn | 1...8 | |

Weekday in a month | fxn | x: 1...5, n: 1...7 | |

Weekday in a month | lxn | x: 1...5, n: 1...7 | |

Hour | hnn | 0...23 | x |

Minute | mnn | 0...59 | x |

Second | snn | 0...59 | x |

Notice that the time terms, for the starting date and for the duration, must be added following the logical sequence.

**Starting date combination**:

**Duration combination**:

Notice that the days of the week are ordered from Sunday to Saturday. The value 8 stands for public holiday. Furthermore the days of the week are the only term that can be used recursive in the starting date block as can be seen in the examples below. Also there are two possible terms for the definition of certain weekdays of a month. Both define the parameter n in the format as the weekdays (in the same order as mentioned for the days). The parameter x is interpreted differently, i.e. in the format fxn it is the first/second/... occurence of the day in the month whereas in the format lxn it is the last/last but one/... occurence of the day in the month.

**Examples**:

- [(h9){h3}] represents intervals from 9am to 12am every day
- [(y2016M2h10){m30}] represents intervals on each day of february 2016 from 10am to 10:30am
- [(t2t3t4h8){h10}] represents intervals from 8am to 6pm on mondays, tuesdays and wednesdays

#### Combining time domains

It is also possible to combine multiple GDF time domains. There are three basic possibilities to do that:

**Union of sets**: via the operator**+****Intersection of sets**: via the operator*******Subtraction of sets**: via the operator**-**

**Examples**:

- [[(h9){h3}] + [(h13){h4m30}]] represents intervals from 9am to 12am and from 1pm to 5:30pm every day
- [[[(h9){h3}] + [(h13){h4m30}]] * [(t2){d5}]] restricts the above intervals to the weekdays monday until friday
- [[[[(h9){h3}] + [(h13){h4m30}]] * [(t2){d5}]] - [(M12d24){d1}]] excludes the 24th of December from the above intervals

#### Restrictions

Since the time zone of a GDF time domain in the xTour service is set to the time zone of the planning horizon, a time domain will not consider a clockchange between summertime and wintertime or the other way round.

#### Syntax that can occur in Feature Layers

The following syntax also defines valid GDF time domains and can occur in Feature Layers, but it is not (fully) supported as input for the xServer interval type GDF time domains.

Alternatively to the above syntax a basic time domain may be composed of a starting date and an ending date with the following notation: **[(Starting Date) (Ending Date)]**.

**Example**:

- [(M5 d1) (M5 d2)] represents intervals in any year starting on the first of may (at 0am) and ending on the second of may (at 0am).

**Special cases** of a time domain are:

- A starting date without a specified duration, like [(h1)] for the beginning of every full hour, and
- a time period specified by means of a time duration only, like [{h1}] for one hour elapsed time.

It is specific for each time domain related attribute whether the general syntax or one of the two special cases mentioned is appropriate for representing the respective time domain value. Note that both special cases have mandatory encasing brackets.

For time domain fields which expect both start date and duration, it is possible to provide only a start time, and the missing of the duration signifies an implicit "always", post the starting date. When both are expected, a start date is mandatory, i.e. having only duration would be "wrong".

Minus signs '-' play also a special role within the time syntax. It may precede the duration component, which changes the duration semantics into a negative duration: that is a duration which "clocks backwards". A minus sign may precede a solitary start term without a duration clause when both where expected, and so the "always" duration implied (as above) becomes "negative always", which then would read "always until the start time". There are other uses of minus signs within either term which are explained in their respective sections, and there are minus signs used in compound time expressions and those are explained in that section.

**Example**:

- [(M5 d1) -{d1}] represents intervals in any year starting on the first of May (at midnight) with duration of one day
**into the past!**, i.e. the last day of April is addressed.

### Related Topics

Technical Concept | Feature Layer Basics |