如何在 Kusto 中将秒转换为 HH:mm:ss 格式

lac*_*zul 3 logging type-conversion azure kql azure-data-explorer

我想知道以秒为单位转换持续时间的最佳方法,例如 HH:MM:SS。

我找到了一个解决方案,但我认为它不是最好的:

我使用随机日期时间make_datetime(2017,1,1),添加秒数,datetime_add然后格式化结果以获得“HH:mm:ss”

AzureDiagnostics 

| project  

Duration = format_datetime(
                   datetime_add('second',
                                toint(Output_copyDuration_d),
                                make_datetime(2017,1,1)
                                ),
                   "HH:mm:ss")
Run Code Online (Sandbox Code Playgroud)

其中 Output_copyDuration_d 是以秒为单位存储的持续时间

我的结果是正确的

如果 Output_copyDuration_d = 234 那么我得到 Duration = 00:03:54