Forum Discussion
ericOnline
7 years agoPost Patron
Convert utc to local time zone using Power Query
Hello, Does anyone have a better example for how to add hours (DateTime.AddZone) to a date-time value? The docs are not clear on this: DateTime.AddZone(#datetime(2010, 5, 4, 6, 5, 5), 8) equals...
- 7 years ago
Hi ericOnline,
Based on my test, you could refer to below steps in query editor:
Add custom column:
if [ID]=1 then [Date]+#duration(0,2,0,0) else if [ID]=2 then[Date]+#duration(0,1,0,0) else null
Result:
You could also download the pbix file to have a view.
Regards,
Daniel He
hinteadan
7 years agoNew Member
Hello ericOnline, you are right, it's rather incomplete not incorrect. DST is a sneaky **bleep** which we tend to forget about, but actually want to consider when converting timestamps. I removed my original reply and posted one with the URL for the solution that includes DST.
ericOnline
7 years agoPost Patron
Hi hinteadan. You’re right! I haven’t shared the app with anyone outside my time zone so didn’t encounter the issue pointed out in the blog. Great catch. Thanks for posting this!