Declaring Date Variables

To hold date values in your program, use date variables. Like string variables, date variables are prefixed with a dollar sign ($). You must explicitly declare date variables by using the DECLARE-VARIABLE command.

Date variables are useful for holding results of date calculations. For example:

begin-setup
   declare-variable
      date $c
   end-declare
end-setup
...
let $c = strtodate('March 1, 2004 12:00','Month dd, yyyy hh:mi')
print $c () edit 'dd/mm/yyyy'

In this code example, $c is declared as a date variable. Later, it is assigned the value of noon on March 1, 2004. The $c variable is then printed with the dd/mm/yyyy edit mask, which yields 01/03/2004.

Date variables can be initialized with date literals as shown in this example:

begin-setup
   declare-variable
      date $c
   end-declare
end-setup
...
let $c = '20040409152000'

The LET statement assigns 3:20 in the afternoon of April 9, 2004 to $c.