DATE_TO/DT_TO conversionsPermalink

Converting from the variable type DATE or DATE_AND_TIME to a different type:

The date will be stored internally in a DWORD in seconds since Jan. 1, 1970. This value will then be converted.

When you perform a type conversion from a larger to a smaller type, you risk losing some information.

For STRING type variables, the result is the date constant.

Examples in ST:

(* Result is FALSE *)
b :=DATE_TO_BOOL(D#1970-01-01);
 
(* Result is 29952 *)
i :=DATE_TO_INT(D#1970-01-15);

(* Result is 129 *)
byt :=DT_TO_BYTE(DT#1970-01-15-05:05:05);
 
(* Result is 'DT#1998-02-13-14:20' *)
str:=DT_TO_STRING(DT#1998-02-13-14:20);

Examples in FUP:

date_to_bool
date_to_int
date_to_byte
dt_to_string