Zoomdata Version

Time Functions

The following time functions are supported. Valid values for <timepart> vary, based on the Zoomdata connector selected, but can include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND, or MILLISECOND. Review the documentation for the Zoomdata connector for any deviations from this list.

Function Description
EXTRACT

Extracts the <timepart> of the <datetime> field:

extract(<timepart>,<datetime>)

In the following example, the day of the week is extracted:

EXTRACT (day, NOW()) 
TIME_ADD

Adds an interval value to the <timepart> of the <datetime> field:

time_add(<timepart>, <interval>, <datetime>)

In the following example, 7 is added to the hour in the field called date_time_field:

TIME_ADD (hour, +7, date_time_field)
TIME_TO_UNIX_TIME

Returns the value of a <datetime> field as a Unix timestamp:

time_to_unix_time(<datetime>)

For example:

TIME_TO_UNIX_TIME (NOW())
TRUNCATE_TIME

Rounds (Truncates) the <datetime> field value down to the granularity specified by <timepart>:

truncate_time(<timepart>,<datetime>)

In the following example, the current time is truncated to the day of the week:

TRUNCATE_TIME (day, NOW())

Was this topic helpful?