Time Data Types

The data types TIME, TIME_OF_DAY (abb. TOD), DATE and DATE_AND_TIME (abb. DT) are handled internally like DWORD.

Time is given in milliseconds in TIME and TOD, time in TOD begins at 12:00 A.M.

Time is given in seconds in DATE and DT beginning with January 1, 1970 at 12:00 A.M.

See in the following the time data formats used to assign values for time constants:

TIME constants:

always made up of an initial “t” or “T” (or “time” or “TIME” spelled out) and a number sign “#”.

This is followed by the actual time declaration which can include days (identified by “d”), hours (identified by “h”), minutes (identified by “m”), seconds (identified by “s”) and milliseconds (identified by “ms”). Please note that the time entries must be given in this order according to length (d before h before m before s before m before ms) but you are not required to include all time increments.

Maximum value: 49d17h2m47s295ms (4194967295 ms)

Examples of correct TIME constants in a ST \ assignment:

TIME1 := T#14ms;  
TIME1 := T#100S12ms; (*The highest component may be allowed to exceed its limit*)
TIME1 := t#12h34m15s;  

the following would be incorrect:

TIME1 := t#5m68s; (*limit exceeded in a lower component*)
TIME1 := 15ms; (*T# is missing*)
TIME1 := t#4ms13d; (*Incorrect order of entries*)

DATE Constants:

A date constant begins with a “d”, “D”, “DATE” or “date” followed by “#”. You can then enter any date with format Year-Month-Day. Possible values: 1970-00-00 to 2106-02-06.

Examples:

DATE#1996-05-06
d#1972-03-29

TIME_OF_DAY Constants, \ for storing times of the day:

begin with “tod#”, “TOD#”, “TIME_OF_DAY#” or “time_of_day#” followed by a time with the format: Hour:Minute:Second. Seconds can be entered as real numbers or you can enter fractions of a second. Possible values: 00:00:00 bis 23:59:59.999.

Examples:

TIME_OF_DAY#15:36:30.123
tod#00:00:00

DATE_AND_TIME Constants, combination of date and the time of \ day:

begin with “dt#”, “DT#”, “DATE_AND_TIME#” or “date_and_time#”. Place a hyphen after the date followed by the time.  Possible values: 1970-00-00-00:00:00 to 2106-02-06-06:28:15.

Examples:

DATE_AND_TIME#1996-05-06-15:36:30
dt#1972-03-29-00:00:00