How to convert time ( 01:02:00) to 1 hr 2 mins in looker

Hi Have a date column with 02:01 :03 like this then how can I display it in user readable format.

ex :  02:01 :03  to 2h 1m 5 sec

0 1 827
1 REPLY 1

No easy way to do that. You’d have to do few things:

  • Create field of type timestamp/datetime that has your time
  • Create another field that has 00:00:00 but the same date (date doesn’t actually matter)
  • Create duration field with sql_start and sql_end as those two fields
  • Change HTML of this field - in order to display all the components (h, m, s)

This could be of help: https://help.looker.com/hc/en-us/articles/4420187817491-Creating-hour-minute-durations-in-visualisat...

dimension: elaped_formatted {
type: number
sql: ${seconds_elapsed} ;;
html: {% assign h = {{value}} | divided_by: 3600 %}{% assign m = minutes_elapsed._value | modulo: 60 %}{% assign s = seconds_elapsed._value | modulo: 60 %}{{h}}h{{m}}m{{s}}s;;

}
Top Labels in this Space
Top Solution Authors