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
请参阅:https : //docs.microsoft.com/en-us/azure/kusto/query/datetime-timespan-arithmetic
例如:
print seconds_as_timespan = 1234 * 1s
Run Code Online (Sandbox Code Playgroud)
返回 00:20:34
| 归档时间: |
|
| 查看次数: |
2121 次 |
| 最近记录: |