Date and time functions

You can use date and time functions to obtain the current time, or to perform date and time conversions.

Times are specified in UNIX time (as the number of elapsed seconds since midnight on 1st January 1970 UTC). The following table describes the date and time functions supported in rules files.

Table 1. Date and time functions
Function Description Rules file example
datetotime(string, conversion_specification) Converts a textual representation of a time stamp into UNIX epoch time (that is, the number of seconds since 00:00:00 1 Jan 1970 UTC). $Date = datetotime("Tue Dec 19 18:33:11 GMT+00:00 2000", "EEE MMM dd HH:mm:ss ZZZZ yyyy")
getdate Takes no arguments and returns the current date as a UNIX epoch time stamp. $tempdate = getdate
timetodate(UTC, conversion_specification) Converts a time value into a string. @Summary = "Occurred at " + timetodate ($StateChange, "HH:mm:ss, MM/dd/yy")

$Time2 = timetodate (@EventTime, 'EEE MMM dd HH:mm:ss yyyy')

The conversion_specification parameter of the datetotime and timetodate functions is the date and time format in which you want the conversion to be expressed. The following table provides examples of the input and output data that matches some possible date and time formats.
Note: POSIX date and time formats were deprecated with Tivoli Netcool/OMNIbus V7.3 and replaced by Locale Data Markup Language (LDML) date and time patterns. LDML date and time patterns are defined at Date/Time Format Syntax external icon in the ICU documentation.
Table 2. Some LDML date and time formats and matching input and output
Format Example input and output data
MM/dd/yy 02/29/12
MMMM December
d/M/yyyy H:m:s 19/12/2000 18:33:11
EEE MMM dd HH:mm:ss ZZZZ yyyy Tue Dec 19 17:33:11 GMT 2000
yyyy-MM-dd:hh:mma v 2009-03-28:02:00PM United Kingdom Time
EEE MMM dd HH:mm:ss yyyy ZZZ Sun Jan 15 08:30:00 2006 +0500

For more information about the LDML date and time formats used in Tivoli Netcool/OMNIbus, see the link located under Related information on this page.

Note: To help troubleshoot problems with datetotime functions, enable extra debugging when converting timezones. For more information about the NDE_DATETOTIME_DEBUG parameter, see: Setting environment variables