Forum Discussion
Date.From(datetimezone) returns different results when using On-Premises Gateway
- 2 months ago
Hi,
This looks like a timezone handling difference between the Power BI Service and the On-premises Data Gateway, rather than an issue with Date.From() itself.
Date.From(JST) is working with a datetimezone value, so the gateway may be applying its local/system timezone when converting it to a date. DateTimeZone.RemoveZone(JST) removes the timezone information first, which is why Date2 remains unchanged.
Since the behavior differs between execution with and without the gateway, I would treat this as a gateway/runtime timezone inconsistency and avoid relying on implicit timezone conversion.
As a workaround, explicitly remove or apply the required timezone before extracting the date, for example:
Date.From(DateTimeZone.RemoveZone(JST))
Also check the gateway machine's regional/timezone settings, as these can influence datetime conversions.
If the same M code produces different results in the Service depending only on whether the gateway is used, it would be worth raising this with Microsoft Support as a potential gateway/Dataflow Gen1 issue.
Hope this Helps!
Thanks
Hi,
This looks like a timezone handling difference between the Power BI Service and the On-premises Data Gateway, rather than an issue with Date.From() itself.
Date.From(JST) is working with a datetimezone value, so the gateway may be applying its local/system timezone when converting it to a date. DateTimeZone.RemoveZone(JST) removes the timezone information first, which is why Date2 remains unchanged.
Since the behavior differs between execution with and without the gateway, I would treat this as a gateway/runtime timezone inconsistency and avoid relying on implicit timezone conversion.
As a workaround, explicitly remove or apply the required timezone before extracting the date, for example:
Date.From(DateTimeZone.RemoveZone(JST))
Also check the gateway machine's regional/timezone settings, as these can influence datetime conversions.
If the same M code produces different results in the Service depending only on whether the gateway is used, it would be worth raising this with Microsoft Support as a potential gateway/Dataflow Gen1 issue.
Hope this Helps!
Thanks
SamInogic
Thank you for your explanation.
Adding DateTimeZone.RemoveZone() resolved the issue, and I have updated my dataflow to use this approach as a workaround.
I appreciate your help and insights.
- SamInogic2 months ago
Super User
Hi,
Glad to know our solution worked for you.
Can you please mark our solution as accepted solution so that next time if someone else has same issue they will know our solution would work since it worked for you and hence you marked as accepted.
Thanks!