Skip to main content

Cron Notation

In search of a handy notation to describe all possible situations (i.e. all possible combinations of time of forecasting, forecasting horizon and data availability) the Cron-notation surfaced. The Cron-notation is used to easily enumerate all the daytime instances of repeating processes, meaning it provides a straightforward and interpretable way to formulate timestamps. TIM supports four different time instances, namely Day, Hour, Minute and Second. All of these time instances should be specifically and individually enumerated.

A couple of basic rules apply:

  • To enumerate days, the first two letters of the names of the day should be used. For example, notations such as We or Fr are correct.
  • It is possible to list multiple options. This is done by separating them with ,. For example, the notation We,Fr is correct.
  • To specify a range of options, the notation includes the lower and upper bound of the range, separated by -. The step size between the elements in the range is specified after a slash. For example, a correct notation of the options "0, 3, 6, 9, 12, 15" is 0-15/3.
  • To specify all possible options, a star is used as a short notation. For example, the options "Mo, Tu, We, Th, Fr, Sa, Su" can simply be specified as *, which would be correct.

The resulting time instances are basically a Cartesian product of all four fields. If not specified, the default value for the Day and Hour instances is * (i.e. all possible options); for Minute and Second instances the default value is 0.

Below is an example of a cron notation used in TIM API.

[
{
"type": "Day",
"value": "*"
},
{
"type": "Hour",
"value": "5,6"
},
{
"type": "Minute",
"value": "40"
},
{
"type": "Second",
"value": "2-5/3"
}
]

This example denotes: "Every day at 05:40:02, 05:40:05, 06:40:02, and 06:40:05".