Skip to main content

Time Intelligence Functions

This type of function is used to process date/time value and support both approaches:

  • Truncate a TIMESTAMP or an INTERVAL value based on a specified date part e.g., hour, week, or month
  • Extracts a subfield from a date or time value
danger

Currently, Holistics only supports epoch funtion. Other functions are not available.

Please visit this guide as our workaround for extracting a subfield from a date or time value.


epoch()

epoch(date)
epoch(datetime)

Description

epoch returns a Unix timestamp which is the number of seconds that have elapsed since ‘1970-01-01 00:00:00’ UTC.

You can use this function to return a Unix timestamp based on the current date/time or another specified date/time.

Return type

Vary

Example

Given a Holistics expression as below:

epoch(created_at)

The result would be:

created_atepoch(created_at)
2018-06-12 09:26:491528795609
2018-06-121528761600

date_trunc

date_trunc(datetime, time_col: 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute')

Description

Truncate a TIMESTAMP on specific date part

Return type

datetime


now()

now()

Description

Function that returns current time

Return type

datetime


day()

day()

Description

Extract the day from a given timestamp

Return type

number


month()

month() 

Description

Extract the month from a given timestamp

Return type

number


year()

year()  

Description

Extract the year from a given timestamp

Return type

number


quarter()

quarter()       

Description

Extract the quarter from a given timestamp

Return type

number


week()

week()          

Description

Extract the week from a given timestamp

Return type

number


hour()

hour()              

Description

Extract the hour from a given timestamp

Return type

number


minute()

minute()                    

Description

Extract the minute from a given timestamp

Return type

number


week_day()

minute()                    

Description

Return the day number of a specific date (within a week)

Return type

number


week_num()

week_num()                      

Description

Return the week number of a specific date (within a year)

Return type

number


Let us know what you think about this document :)