Skip to main content
Community site session details

Community site session details

Session Id : jIBrq06nhHd1AWDo3EPiCO
Power Apps - Building Power Apps
Answered

Timer display time on powerapps and server

Like (0) ShareShare
ReportReport
Posted on 13 Apr 2020 09:38:22 by 220

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"),

Categories:
  • Verified answer
    v-yutliu-msft Profile Picture
    on 15 Apr 2020 at 03:26:43
    Re: Timer display time on powerapps and server

    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, 

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on 14 Apr 2020 at 08:04:57
    Re: Timer display time on powerapps and server

    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.

    2020-04-14_19-58-19.png

    Hope this helps

  • P_SA Profile Picture
    220 on 14 Apr 2020 at 06:02:27
    Re: Timer display time on powerapps and server

    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 ?

  • v-yutliu-msft Profile Picture
    on 14 Apr 2020 at 05:34:56
    Re: Timer display time on powerapps and server

    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,

  • WarrenBelz Profile Picture
    148,876 Most Valuable Professional on 13 Apr 2020 at 09:51:40
    Re: Timer display time on powerapps and server

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2