11. Report-Writer Expressions and Formats : Types of Data in Expressions : Date Constants
 
Share this page                  
Date Constants
Dates are referenced as single‑quoted character string constants. However, as with string constants within a .query statement, the quotation marks appropriate to your query language must be used.
Report-Writer accepts the following variations as date expression. You can specify a date template for the date expression in the .print, .format, or .tformat statement. For details, see Format Specifications (see page Format Specifications).
Absolute dates - Examples of expressions of the date November 15, 1998 are:
'11/15/98'
'15-nov-98'
'15-nov-1998'
'11-15-98'
'98.11.15'
'111598'
'11/15'
'11-15'
The string 'today' is a legal absolute date, which returns today's date as its value. The string 'now' is a legal absolute date and time, which returns today's date and the current time as its value.
Absolute times - Examples of expressions of the time 10:30:00 are:
'10:30:00'
'10:30:00 pst
'10:30'
Note:  Report-Writer supplies the appropriate time zone designation. Time formats are assumed to be on a 24-hour clock. However, time entered with a designation of "am" or "pm" is automatically converted to 24-hour internal representation. Any such designation must follow the absolute time and precede the time zone, if included. If you do not specify a date with an absolute time, today's date (that is, the current day) is supplied.
Absolute date and time - Examples of expressions of the date and time, November 15, 1998, 10:30:00 are:
'11/15/98 10:30:00'
'15-nov-98 10:30:00'
'11/15/98 10:30:00 pst'
'15-nov-98 10:30:00 pst'
'11/15/98 10:30'
'15-nov-98 10:30'
'11/15/98 10:30 pst'
'15-nov-98 10:30 pst'
Date intervals - Examples of date interval expressions are:
'5 years'
'8 months'
'14 days'
'5 yrs 8 mos 14 days'
'5 years 8 months'
'5 years 14 days'
'8 months 14 days'
Time intervals - Examples of time interval expressions are:
'23 hours'
'38 minutes'
'53 seconds'
'23 hrs 38 mins 53 secs'
'23 hrs 53 seconds'
'28 hrs 38 mins'
'38 mins 53 secs'
'23:38 hours'
'23:38:53 hours'