Hello everyone and welcome to my blog. In today’s blog I will show how you can convert a local DateTime to UTC time.
Let’s get started. If you are from traditional programming, you will find constructs like ConvertToUTC or something similar. In Power Apps however, you don’t have any sort of function like that.
Rather, Power Apps has a function TimeZoneOffset using which we can convert local time to UTC in Power Apps.
In the above screen shot, I have set the text of the label to Now() which prints the local datetime. I want to convert it to UTC time. For reference, my timezone is UTC+5:30
I use the below code to convert the local time to UTC time.
DateAdd(
Now(),
TimeZoneOffset(),
TimeUnit.Minutes
)
And below is the output.
Hope this helped.
Debajit
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.