web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Replica SharePoint Cou...
Power Apps
Answered

Replica SharePoint Countdown Timer

(0) ShareShare
ReportReport
Posted on by 56

In short:

 

I need a countdown timer to a specific day (Thursday) at a specific time (9 am) that recurs weekly and resets the value when it ends. It should look like the Countdown Timer web part in SharePoint, so it should display days, hours, minutes, and seconds (with a zero in front of each when appropriate).

 

Additional information:

 

Using a simple countdown feature (in conjunction with a Timer control) doesn't seem to work because the number of milliseconds in a week (604800000) seems to be outside the scope/maximum of either the timer control or the Text function. And as a result, the output defaults to "01:23:59:59", which makes it seem like the max is 2 days (which can't be true). Here is what I used in the Text property of Timer1: 

 

Text(Time(0, 0, (Timer1.Duration-Timer1.Value)/1000), "dd:hh:mm:ss")

 

Also, it doesn't seem like the countdown is stored/saved between refreshing the app. So, this all led me to use the DateDiff() function which wouldn't need to store a countdown value; it would just subtract Now() from the target date (Thursday at 9 am). But I couldn't figure out how to turn the target date into a variable that could arithmetically play with Now().

 

Spent a lot of time looking into this to no avail. Thanks everyone!

Categories:
I have the same question (0)
  • ChadRobbins Profile Picture
    56 on at

    Interesting, this solution doesn't seem to exist?

  • Verified answer
    ChadRobbins Profile Picture
    56 on at

    App.OnStart

    Set(viWeekDay, 5);
    Set(vsNow, Now());
    Set(viDelta, viWeekDay - Weekday(vsNow));
    If(viDelta < 1,Set(viDelta, viDelta + 7););
    Set(viTargetDay,DateAdd(DateValue(DateAdd(vsNow,viDelta,TimeUnit.Days)),9,TimeUnit.Hours));

     

    Timer_DaysHoursMinutes.OnTimerStart
    If( Now() > viTargetDay,Set(viTargetDay, DateAdd(viTargetDay,7,TimeUnit.Days)));

    Set(viDeltaMinutes, Max(DateDiff(Now(),viTargetDay,TimeUnit.Minutes),0));
    Set(viDeltaHours, Max(RoundDown(viDeltaMinutes/60,0),0));
    Set(viDeltaDays, Max(RoundDown(viDeltaHours/24,0),0));
    Set(viDeltaMinutes, viDeltaMinutes - (viDeltaHours * 60));
    Set(viDeltaHours, viDeltaHours - (viDeltaDays * 24));

     

    I experimented with a few different options on how best to play with the seconds, but I think the easiest I found was to create a separate timer that just counts to 60 seconds.

     

    All credit goes to a colleague, thanks David.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard