Using "current_date()" in custom field

I would like to count the number of days that elapse between an event and the current date. When I use the below syntax in the custom field, I get this error: Unknown function "current_date"

diff_days(current_date(), ${timeclock_employee_hours.time_in_date})

Any idea how to get a custom field calculation to return an integer for difference between current data and timeclock event?

0 2 70
2 REPLIES 2

Try function now()

As Shru said, you can use now().

Just be careful, now() will return as the database timezone while ${timeclock_employee_hours.time_in_date} will can have a transformed timezone.

To get around that, set up a dimension "now" with type: date and the sql now() and then reference that dimension in your date_diff query. Then both dates will be converted to the appropriate timezone.

Top Labels in this Space