gpt4 book ai didi

azure - KQL 中的自定义日期格式

转载 作者:行者123 更新时间:2023-12-03 07:07:36 25 4
gpt4 key购买 nike

我想知道是否可以在 KQL 中自定义特定日期时间的格式。

例如我有以下代码:

let value = format_datetime(datetime(07:30:00), "HH:mm");
print value

结果我们得到 07:30

我的问题是,除了 07:30 之外,是否可以将其格式化为值 = 7hr 30m

最佳答案

根据您的输入是datetime还是timespan值,您可以尝试以下任一选项(使用一些字符串操作):

print ts = timespan(07:30:00)
| project output = strcat(toint(ts/1h), "hr ", toint(ts/1m)%60, "min")

print dt = datetime(2021-02-16 07:30:00)
| project output = strcat(datetime_part("hour", dt), "hr ", datetime_part("minute", dt), "min")

关于azure - KQL 中的自定义日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71145451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com