在查询中使用当地时间

时间:2018-08-10 16:01:39

标签: azure azure-application-insights

我希望此查询的结果显示的是本地时间而不是UTC:

union * 
|  
order by timestamp desc

我该如何显示本地时间?我知道dateadd(timestamp - 7h)上有一些变化,但我不知道。

2 个答案:

答案 0 :(得分:1)

由于所有日期时间均以UTC表示,因此将其转换为我们的本地时区通常很有用。为了简单地查看数据,我们可以使用日期时间数学添加一列,以增加或减少必要的小时数。您可以参考此article以获得更多详细信息。

union * 
| extend localTimestamp = timestamp - 7h
| order by localTimestamp desc 

enter image description here

答案 1 :(得分:0)

现在还可以通过UI设置将所有报告默认为本地时间,这在您必须考虑夏令时时会有所帮助。

enter image description here

enter image description here