
147
CLEM Language Reference
Note: Date and time functions cannot be ca lled from scripts.Function Result Description
@TODAY String
Ifyou select Ro llover days/mins in the stream properties
dialog box, this function returns the current date as a
stringin the currentdate f ormat. If you use a two-digit
date format and do not select Rollover days/mins, this
function returns $null$ on the current server. Note that
this function cannot be called from a script.
to_time(ITEM) Time Convertsthe storage of the s pecified field to a time.
to_date(ITEM) Date Converts the storage of the specified field to a date.
to_timestamp(ITEM) Timestamp Converts the storage of the specified field to a
timestamp.
to_datetime(ITEM) Datetime Converts the storage of the specified field to a date,
time, or timestamp value.
datetime_date(ITEM) Date
Returns the date value for a number,string, or
timestamp. Note this is the only function that allows
you to convert a number (in seconds) back to a date.
If ITEM is a string, creates a date by parsing a string
inth e current date format. The date format specified
inthe s tream properties dialog box must be correct for
this function to be successful. If ITEM is a number, it
is interpreted as a number of seconds since the base
date (or epoch). Fractions of a day are truncated. If
ITEM is timestamp, the date part of the timestamp is
returned. If ITEM is a date, it is returned unchanged.
date_before(DATE1,DATE2) Boolean
Returns a value of true if DATE1represen ts a date
or timestamp before that represented by DATE2.
Otherwise, this function returns a value of 0.
date_days_difference(DATE1,
DATE2) Integer
Returns the time in days from the date or timestamp
represented by DATE1to that repre sented by DATE2,
asan integer. IfD ATE2is before DATE1, this function
returns a negative number.
date_in_days(DATE) Integer
Returns the time in days from the baseline date to the
dateor tim estamp represented by DATE, as an integer.
If DATEis b efore the baseline date, this function
returns a negative number. You must include a valid
date for the calculation to work appropriately. For
example, you should not specify 29 February 2001 as
the date. Because 2001 is a not a leap year, this date
does not exist.
date_in_months(DATE) Real
Returns the time in months from the baseline date to
thed ate ortim estamp represented by DATE, as a real
number. This is an approximate figure based on a
monthof 30 .4375 days. If DATE is before the baseline
date, this function returns a negative number. You
must include a valid date for the calculation to work
appropriately. For example, you should not specify 29
February 2001 as the date. Because 2001 is a not a
leap year,th is date does not exist.