Hello, I have a timer function in PowerApps. It has a custom API from d365 instance. There is a parameter control in D365 which stops the timer exactly at midnight based on the server timing[GMT timezone] of d365.
Now here is the scenario. When I start the timer[india timezone] say at 9pm , the timer is stopped at 5:30AM [india time] which is 00:00 midnight based on server time.
I want the timer to stop exactly at midnight based on the user's timezone and not server time..
Is it possible to achieve ?
Current behavior : timer started at xx:xx hours- stops at 5:30am[server time]
expected behavior : timer started at xx:xx hours- should stop at 00:00 midnight[based on user timezone ]
function : If(ThisItem.Running = 0, Text(ThisItem.StartDateTime, "[$-en-US]mmm dd yyyy hh:mm:ss") & " - " & Text(ThisItem.EndDateTime, "[$-en-US]mmm dd yyyy hh:mm:ss"),
Hi @P_SA ,
Do you want to transfer time based on time zone dynamics?
If so, I suggest you try TimeZoneOffset() function, which will return the time difference between local time and UTC time automatically.
Try this:
If(ThisItem.Running = 0, Text(DateAdd(ThisItem.StartDateTime,TimeZoneOffset(),Minutes), "[$-en-US]mmm dd yyyy hh:mm:ss") & " - " & Text(DateAdd(ThisItem.EndDateTime,TimeZoneOffset(),Minutes), "[$-en-US]mmm dd yyyy hh:mm:ss")
Here's a doc about this function:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff
Best regards,
Hi @P_SA,
CDS works with UTC time and is saved in UTC at rest. It's suggested to always convert to UTC when your manipulating with dates. Question: I'm not too sure what your scenario is, but since it involves timer and triggering an action, would it be possible to move that logic to Power Automate? There's an out-of-the-box Date Time connector which you can use and convert timezones.
Hope this helps
Hello @v-yutliu-msft , Thanks for your reply. I understand what you suggested. But this formula will work only for India .
How do I generalize the formula to work with any timezone of the Power App user globally ?
Hi @P_SA ,
Do you want to transfer 5:30am to 0:00 midnight?
If so, I suggest you try DateAdd function to transfer time.
Since the expected time is earlier then india time 5 and a half hours, you just need to subtract five and a half hours from the current time.
Try this formula:
If(ThisItem.Running = 0, Text(DateAdd(ThisItem.StartDateTime,330,Minutes), "[$-en-US]mmm dd yyyy hh:mm:ss") & " - " & Text(DateAdd(ThisItem.EndDateTime,330,Minutes), "[$-en-US]mmm dd yyyy hh:mm:ss")
Here's a doc about this function for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff
Best regards,
Hi @P_SA ,
Please look at the TimeZoneOffset function - this should achieve your requirements.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2