slthomason
slthomason

Reputation: 383

Use local time in query

I want my results from this query to show with local time not the UTC:

union * 
|  
order by timestamp desc

How would I go about getting that to show local time? I know it is some variation on dateadd(timestamp - 7h) but I can't figure out.

Upvotes: 5

Views: 6622

Answers (2)

GerardBeckerleg
GerardBeckerleg

Reputation: 902

There is also now the ability through the UI settings to default all reports to local time, this helps when you have to account for daylight savings.

enter image description here

enter image description here

Upvotes: 5

Joey Cai
Joey Cai

Reputation: 20067

Since all datetimes are expressed in UTC, it is often useful to convert these into our local timezone. For simply viewing data, we can add a column using datetime math to add or subtract the necessary number of hours. You could refer to this article for more details.

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

enter image description here

Upvotes: 9

Related Questions