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
The current solution IS NOT correct, it doesn't take Daylight Saving Time into account. The following blog post describes the correct solution: https://seddryck.wordpress.com/2018/03/22/converting-datetime-from-utc-to-local-time-with-power-query-m-language/