- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
例如,我有一个查询,
workspace("someanalytics").somecheck
| where someProperties_s contains "something"
| project someProperties_s , TimeGenerated
| extend somethingAB = parse_json(someProperties_s)
| extend somethingabc= somethingAB.something
| project TimeGenerated, tostring(somethingabc)
| order by TimeGenerated, somethingabc desc
| extend somethingabcchart = somethingabc
| parse somethingabcchart with minutes:int ":" seconds:int "." ms:int
解析前的旧结果
生成时间 [UTC]:somethingabc:somethingabcchart
2021 年 9 月 8 日上午 9:37:01.532 : 00:27.49 : 00:27.49
2021 年 9 月 8 日,上午 9:38:22.112 : 00:25.67 : 00:25.67
2021 年 9 月 8 日,上午 9:39:51.473 : 00:30.50 : 00:30.50
2021 年 9 月 8 日,上午 9:41:31.722 : 00:33.89 : 00:33.89
2021 年 9 月 8 日,上午 9:43:01.623 : 00:28.10 : 00:28.10
2021 年 9 月 8 日,上午 9:44:31.567 : 00:27.18 : 00:27.18
图像显示了检查此链接后的当前结果 How to convert string column to time column type?在这里,我希望将时间戳日期转换为秒,正如您在图像中看到的那样,它应该在“somethingabcchart”列下给出 95 秒
00:27.49 仅给出 27 秒如果它是01.01.00 然后只有 61 秒作为 someabc 列或 someabcchart 列下的结果,因为它在时间戳日期中,所以不可能在 azure 查询上创建图表,因此需要一种方法来转换为秒。我正在尝试将其转换为string 因为它认为代码的后面部分可以转换回 timedate 然后除以 1 秒来获取秒数,但无法获取数据,我使用此链接作为指导。 << https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/timespan
最佳答案
如果我正确理解你的问题,你可以划分 timespan
值 1s
获取总秒数。
参见:https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datetime-timespan-arithmetic
例如:
datatable(ts:timespan)[timespan(12:34:56), timespan(1.23:45:23.678)]
| extend total_seconds = ts / 1s // <---
或者,如果输入是 string
而不是timespan
:
datatable(ts_str:string)["12:34:56", "1.23:45:23.678"]
| extend ts = totimespan(ts_str)
| extend total_seconds = ts / 1s // <---
关于azure - 如何在azure kusto查询中将todatetime转换为秒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69131996/
我是一名优秀的程序员,十分优秀!