About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Last updated: Feb 11, 2025
Time and date formats may vary depending on your data source and locale. The formats of date and time are specific to each flow and are set in the flow properties.
The following examples are commonly used functions for working with date/time fields.
Calculating time passed
You can easily calculate the time passed from a baseline date using a family
of functions similar to the following one. This function returns the time in months from the
baseline date to the date represented by the date string
as a real number.
This is an approximate figure, based on a month of 30.0 days. DATE
date_in_months(Date)
Comparing date/time values
Values of date/time fields can be compared across records using functions
similar to the following one. This function returns a value of true if the date string
represents a date prior to that represented by the date string
DATE1
. Otherwise, this function returns a value of 0. DATE2
date_before(Date1, Date2)
Calculating differences
You can also calculate the difference between two times and two dates using functions, such as:
date_weeks_difference(Date1, Date2)
This function returns the time in weeks from the date represented by the date
string
to the date represented by the date string DATE1
as a
real number. This is based on a week of 7.0 days. If DATE2
is prior to
DATE2
, this function returns a negative number.DATE1
Today's date
The current date can be added to the data set using the function
. Today's date is added as a string to the specified field or new field using
the date format selected in the stream properties dialog box. See Date and time functions for more
information. @TODAY
Was the topic helpful?
0/1000