user manual

147
CLEM Language Reference
Note: Date and time functions cannot be called from scripts.
Function
Result
Description
@TODAY
String
If you select Rollover days/mins in the stream properties
dialog box, thi s function returns the current date as a
string in t he current date format. If you use a two-digit
date format and do not select Rollover days/mins, this
function returns $null$ on the current s erver. Note that
this function cannot be called from a sc ript.
to_time(ITEM)
Time
Converts the storage of the specied el d to a time.
to_date(ITEM)
Date
Converts the storage of the specied eld t o a date.
to_timestamp(ITEM)
Timestamp
Converts the storage of the specied eld to a
timestamp.
to_datetime(ITEM)
Datetime
Converts the storage of the specied eld 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 secon ds) back to a date.
If ITEM is a
string, creates a date by parsing a string
in the current date format. The date form at specied
in the stream properties dialog box must be correct for
this funct
ion to be successful . If ITEM is a number, it
is interpreted as a number of seconds sin ce the base
date (or epoch). Fractions of a day are truncated. If
ITEM is ti
mestamp, the d at e 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 DATE1 represents a date
or timestamp before that represented by DATE2.
Otherwise, this fu nction returns a value of 0.
date_days_difference(DATE1,
DATE2)
Integer
Returns the time in days from the date or timestamp
represented by DATE1 to that represented by DATE2,
as an integer. If DATE2 is before DATE1, this function
returns a negative num ber.
date_in_days(DATE)
Integer
Returns the time in days from the baseline date to the
date or timestamp represented by DATE, as an integer.
If DATE is before the baseline d ate, this fu nction
returns a n egative number. You must include a val i d
date for t he 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 month s from the baseline date to
the date or timestamp represented by DATE, as a real
number. This is an appro ximate gure based on a
month of 30.4375 days. If DATE is before the baseline
date, this function return s a n egative 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 no t a
leap year, this date does not exist.