Question

Extract Time from DateTime

  • 14 July 2021
  • 1 reply
  • 86 views

I have a Dimension that outputs YYYY-MM-DD HH:MM. Is there a table calc to extract the HH:MM? I can extract the hours separately and the minutes separately, but not as one. 


1 reply

A hacky workaround could be to create a new dimension thats a date_time object with the same year, month, day, and seconds, but with the extracted hour and minutes from the original. Since they all have the same date, the only effective difference is the minutes and hour.

 

So it might look something like this:

date_time(1, 1, 2021, extract_hours(${table_name.date_col}), extract_minutes(${table_name.date_col}), 0)

 

Reply