简体   繁体   中英

Time Conversion of seconds to HH:mm:SS

I need help with understanding how to convert seconds in integers to a HH:mm:ss format to be displayed in Quicksight Analysis.

My org is pulling its own data from REST APIs of tools being provided to us as a service from various vendors. Some of this data has time spent data measured in seconds. I know this is an easy fix in Power BI, however, i am still new to Quicksight and trying to understand how this can be achieved here. I need to be able to do aggregations on the time in seconds and then display the result in the HH:mm:ss format. For eg Handle time of 184, 436, 346 seconds respectively should give an Average Handle time of 00:05:22 and total handle time of 00:16:06. I cannot make changes to the tables in Athena using SQL and need to be able to do this at the dataset level or Analysis level in Quicksight. Please help me understand how this can be achieved.

Thanks in advance!!

Currently conversion of seconds to hh:mm:ss in AWS QuickSight is only available by creating a calculated field with the following function:

concat(toString(floor({field_with_seconds}/3600)),':',toString(floor(({field_with_seconds}%3600)/60)),':',toString({field_with_seconds}%60))

I found issues with the above and rolled my own.

concat(toString(floor(sum(durationSeconds) / 86400)), "D:", substring(formatDate(addDateTime(sum(durationSeconds), "SS", parseDate("2000-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss")), "dd-MM-yyyy HH:mm:ss"), 12, 10))

This method allows you to use this in aggregates and uses the date field to auto-convert seconds into hours minutes seconds without having to do date math. The other added feature is the first part that gives you # of Days.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM