Question

Add timezone conversion when using custom fields

  • 31 March 2021
  • 0 replies
  • 7 views

Userlevel 6
Badge

Sometimes I use Custom Dimensions to split my data by a point in time. Like let’s say 15th of February 2020. I use the following code:

 

${bookings.created_at_date} < date(2020, 2, 15)

 

The problem is that my instance is set to convert our UTC database timestamps to our European time zone. Unfortunately, the SQL doesn’t apply the same to the right side of the expression. I know I can add the add_hours, and that’s what I’ll do but in case we want to allow people to change their time zones in the future, that would cause a problem, therefore I don’t want to hardcode time zone offsets.

 

If the date comparison is with a date that has convert_tz: yes, I think the original date should also be converted. What do you reckon?


0 replies

Be the first to reply!

Reply