If you define a field or a variable with a USAGE DATE clause,
then you can assign a value with one of the four DEC DATATRIEVE
date value expressions:
o "TODAY" returns the value of the current system date.
o "NOW" returns the value of the current system date and time.
o "YESTERDAY" returns the value of one day before the current
date.
o "TOMORROW" returns the value of one day after the current
date.
Note that "NOW" is the only value expression that returns the
time as well as the date. You can use the function FN$DATE to
assign a date field a time that is not current.
You can add or subtract dates. For example, you might want
to know how many days you have to complete a project. Define
variables for today's date and the project date. Then subtract
today's date from the project due date:
DTR> DECLARE T USAGE DATE.
DTR> T = "TODAY"
DTR> DECLARE PROJECT_DUE DATE.
DTR> PROJECT_DUE = "21-AUG-90"
DTR> PRINT (PROJECT_DUE - T)
112
DTR>
DEC DATATRIEVE indicates that the project is due in 112 days.
To use these value expressions, you must assign the DATE data
type to the field or variable. Otherwise, DEC DATATRIEVE treats
the expression as a character string literal. For example:
DTR> PRINT "TODAY"
TODAY
DTR>
DEC DATATRIEVE returns the value "TODAY" because the quoted
expression is not associated with a variable or field of the
DATE data type. However, if you supply an edit string containing
date edit string characters, DEC DATATRIEVE returns the current
system date in the form specified by the edit string:
DTR> PRINT "TODAY" USING DD-MMM-YY
18-Jan-90
DTR>