IBM 15 Switch User Manual


 
150
Chapter 8
Function
Result
Description
time_mins_difference(TIME1,
TIME2)
Real
Returns the time difference in minutes between the
times or timestamps represented by TIME1 and
TIME2, as a real number. If you select Rollover
days/mins in the stream properties dialog box, a higher
value of TIME1 is taken to refer to the previous day
(or the previous hour, if only minutes and seconds are
specied in the current format). If you do not select
the rollover option, a higher value of TIME1 will cause
the returned value to be negative.
time_secs_difference(TIME1,
TIME2)
Integer
Returns the time difference in seconds between the
times or timestamps represented by TIME1 and
TIME2, as an integer. If y ou select Rollover days/mins
in the stream properties dialog box, a higher value
of TIME1 is taken to refer to the previous day (or
the previous hour, if only minutes and s econds are
specied in the current format). If you do not select
the rollover option, a higher value of TIME1 cau ses
the returned value to be negative.
Converting Date and Time Values
Note that conversion functions (a nd any other functions that require a specic type of input, such
as a date or time value) depend on the current formats specied in the Stream Options dialog b ox.
For example, if you have a eld named DATE that is stored as a string with values Jan 2003, Feb
2003, and so on, you could convert it to date storage as follows:
to_date(DATE)
For this conversion to work, select the matching dat e format MON YYYY as t he default date
format for the stream. For more information, see the topic Setting general options for streams in
Chapter 5 on p. 55.
For a n example that converts string values to dates u sing a Filler node, see the stream
broadband_create_models.str, installed in the \Demos folder under the streams subfolder.
Dates stored as numbers.
Note that DATE in the previous example is the name of a eld, while
to_date is a CLEM function. If you have dates stored as numbers, you can convert them using
the datetime_date function, where the number is interpreted as a number of seconds since the
base date (or epoch ) .
datetime_date(DATE)
By converting a date to a number of seconds (and back), you can perform calculations such as
computing the current d ate plus or minus a xed number of days, for example:
datetime_date((date_in_days(DATE)-7)*60*60*24)
Sequence Functions
For some operations, the sequence of events is important. The application allows you to work
with the following record sequences:
Sequences and time series