Please enable JavaScript to view this site.

CWT Software Configuration Handbook 4.40

Time predicates are used to check whether a tariff interval contains the current time.

Time functions

Constant name

Internal value

$daytype

Type of day (see calendarRule)

$year

The current year

$month

The current month [1..12]

$week

The current week of the year [1...53]. The week number is calculated according ISO 8601

$dayofyear

The current day of the year [1..366]

$hour

The current hour of the day [0..23]

$minute

The current minute of the hour [0..59]

$timeofday, $time

The current minute of the day [0..1439]

$timeofweek

The current minute of the week [0..10079]

$dayofmonth

The current day of the month [1..31]

$weekday, $day

The current weekday [0..6], starts with Monday = 0

$timesinceorigin

The number of minutes since the purchase origin (the time the purchase started)

Time of day form

To express a time of the day, write

12.10

Time of week form

To express a time of the week, write

|thu 12.10|

Weekdays

Constant name

Internal value

mon

0

tue

1

wed

2

thurs

3

fri

4

sat

5

sun

6

Months

Constant name

Internal value

jan

1

feb

2

mar

3

apr

4

may

5

jun

6

jul

7

aug

8

sep

9

oct

10

nov

11

dec

12

Constants

Constant name

Description

#always

Always

#inf

Infinity

Comparison operators

Operator

Description

=

Equal to

!=

Not equal to

<

Less than

>

Greater than

<=

Less than or equal to

>=

Greater than or equal to

Ranges

You can specify a range within square brackets [ ]. For Example:, to define a range between Monday and Wednesday you can write one of the following:

[mon, tue, wed]

[mon to wed]

[mon - wed]

[mon wed]

It is possible to specify the start or end of a range as non-inclusive by turning the brackets. For Example: if you want to express "the first 30 minutes of every hour" you can write:
($minute in [0 to 29]) or
($minute in [0 to 30[)

The following variants are possible:

[Start to End]

[Start to End[

]Start to End]

]Start to End[

In set operator

The In set operator is used check whether an element is included in a set of elements.

in set {element-1, element-2, element-3 ... element-n}

Example:

($weekday in set {mon, wed, fri})

Mod operator

The Mod operator is used for defining time predicates such as “every third week”, “odd weeks” or “even weeks”. Since week numbers in the system start with 0 you would express “every odd week” by writing:

($week mod 2)

Logical operators

You can use logical operators when you combine several time predicates.

Not (time predicate)

And (time predicate)

Or (time predicate)

Example:

timepredicate = "((($weekday in [mon to fri]) and ($hour in [08 to 18[)))";