[英]How to convert String date dd-mmm-yyyy hh:mm specific format to Date format
[英]DataStudio and SQL change time format from numbers to hh:mm:ss
我想在 Datastudio(或 SQL)中將度量格式從 float 更改為 HH:MM:SS。
例如:
漂浮 | HH:MM:SS |
---|---|
75 | 00:01:15 |
90 | 00:01:30 |
79.5 | 00:01:20 |
ETC........
如果您輸入的秒數適合 24 小時 - 所以可以顯示為時間類型 - 在下面使用
select format_timestamp('%T', timestamp_seconds(cast(seconds as int64))) time
如果應用於您問題中的示例數據 - output 是
如果輸入秒數超過 24 小時 - 您可以在下面使用 - 它為您提供 H*:MM:SS 格式的字符串表示
select format('%i:%s',
div(cast(seconds as int64), 3600),
format_timestamp('%M:%S', timestamp_seconds(mod(cast(seconds as int64), 3600)))
) time
與 output 作為
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.