Time Functions
Handling and processing time-related data is a critical aspect of many streaming applications. To address these needs, Macrometa GDN Stream Workers offer a diverse set of time functions designed to manipulate and analyze temporal data in real-time.
The time functions available to stream workers include date
, dateDiff
, extract
, utcTimestamp
, dayofWeek
, currentDate
, currentTime
, and many others. These functions enable operations such as extracting specific date components, calculating the difference between dates, converting timestamps to universal time, and obtaining the current date and time.
This section, focuses on the time functions offered for stream workers, demonstrating their usage and highlighting their capabilities in handling temporal data within streaming data pipelines.
📄️ currentDate (Function)
Function returns the system time in yyyy-MM-dd format.
📄️ currentTime (Function)
Function returns system time in HHss format.
📄️ currentTimestamp (Function)
When no argument is provided, function returns the system current
📄️ date (Function)
Extracts the date part of a date or date-time and return it in yyyy-MM-dd format.
📄️ dateAdd (Function)
Adds the specified time interval to a date.
📄️ dateDiff (Function)
Returns difference between two dates in days.
📄️ dateFormat (Function)
Formats the data in string or milliseconds format to the given date format.
📄️ dateSub (Function)
Subtracts the specified time interval from the given date.
📄️ dayOfWeek (Function)
Extracts the day on which a given date falls.
📄️ extract (Function)
Function extracts a date unit from the date.
📄️ timestampInMilliseconds (Function)
Returns the system time or the given time in milliseconds.
📄️ utcTimestamp (Function)
Function returns the system current time in UTC timezone with yyyy-MM-dd HHss format.