# Countdown Timer Help

**URL:** <https://forum.adalo.com/t/countdown-timer-help/27865>\
**Category:** Get Help\
**Created:** [June 1, 2022, 8:46pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865 "2022-06-01T20:46:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bobby](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bobby/32/14843_2.png) [@Bobby](https://forum.adalo.com/u/Bobby)\
**Post date:** [June 1, 2022, 8:46pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/1 "2022-06-01T20:46:29Z")

</div>

Hi, All!

I want to use the countdown timer to to countdown from a date the user enters with the date / time picker.

For example - User selects a date that is 2 weeks from now. The countdown timer would show on their page 14 days, 0 hours, 0 minutes, 0 seconds and countdown from there.

Also, if they come back tomorrow it will still show the correct countdown time.

Any advice?

Thanks!

---

<div class="post-metadata">

**Author:** ![Yongki](https://avatars.discourse-cdn.com/v4/letter/y/7c8e57/32.png) [@Yongki](https://forum.adalo.com/u/Yongki)\
**Post date:** [June 1, 2022, 9:59pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/2 "2022-06-01T21:59:55Z")

</div>

Hi @Bobby ,

I would suggest to save both date time fields to users collection, and subtract them and use the result to transform into hours, minutes and seconds.

For days, just get the integer value, for hours multiply with 24, minutes and seconds with 60 \* and another \* 60.

Play around and you can check the real value, use modulus formula to rebuild the fraction.

---

<div class="post-metadata">

**Author:** ![Bobby](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bobby/32/14843_2.png) [@Bobby](https://forum.adalo.com/u/Bobby)\
**Post date:** [June 1, 2022, 10:22pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/3 "2022-06-01T22:22:47Z")

</div>

When you say both date time fields, do you mean the current day/time and then the future day/time?

You would have to constantly update the current day/time to get the countdown to work correctly though right?

Maybe every time someone visits the page it updates that field to the current day/time?

---

<div class="post-metadata">

**Author:** ![Yongki](https://avatars.discourse-cdn.com/v4/letter/y/7c8e57/32.png) [@Yongki](https://forum.adalo.com/u/Yongki)\
**Post date:** [June 1, 2022, 10:37pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/4 "2022-06-01T22:37:13Z")

</div>

To avoid the continuous getting calculated date time, when user go to that specific screen, current time can be saved and calculated, but this will remove the real time updates.

But you can calculate based on current time directly and show in real time, but this will consume both connection and performance in users device.

---

<div class="post-metadata">

**Author:** ![Bobby](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bobby/32/14843_2.png) [@Bobby](https://forum.adalo.com/u/Bobby)\
**Post date:** [June 2, 2022, 10:08pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/5 "2022-06-02T22:08:17Z")

</div>

I cannot get this to work for the life of me… I still cannot even get an accurate countdown let alone the update factor of it all.

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [June 3, 2022, 9:12am UTC](https://forum.adalo.com/t/countdown-timer-help/27865/6 "2022-06-03T09:12:57Z")

</div>

Hi @Bobby,

This video might be useful for you: [Adalo Mini-App series: CountDown Timer Pause and Continue - YouTube](https://youtu.be/VEXxzOHEsQQ)  
It doesn’t answer your question directly, but explains some parts of the logic working with countdown timer.

Best,  
Victor.

---

<div class="post-metadata">

**Author:** ![Bobby](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bobby/32/14843_2.png) [@Bobby](https://forum.adalo.com/u/Bobby)\
**Post date:** [June 3, 2022, 2:51pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/7 "2022-06-03T14:51:27Z")

</div>

Thanks, @Victor

Any idea how to get the amount of seconds from a date picker?

Do we know how that is stored?

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [June 3, 2022, 3:07pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/8 "2022-06-03T15:07:31Z")

</div>

Hi @Bobby,

Datepicker by itself doesn’t have any functionality. Treat it like a “selector”. So what you can do:

- add a numeric property to some collection (e.g. MySeconds)
- add a button. For this button, add an “Update” action to update MySeconds. The value should be taken from DatePicker and multiplied by 86400.
- the result you get will be number of seconds from 01/01/1970, 12:00 AM, GMT+0.

I am not sure why would you need it though 🙂 If you would like to have a number of seconds between now and some date in future, then you need to update this numeric property with something like “(value from datepicker - current time) \* 86400”.

_Maybe_ you will need it to do in 2 steps: first put the values of Current Time and Datepicker’s into 2 additional datetime properties, and then use the values from these properties to calculate the difference. But in my opinion one-step should work.

Best,  
Victor.

---

<div class="post-metadata">

**Author:** ![Bobby](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bobby/32/14843_2.png) [@Bobby](https://forum.adalo.com/u/Bobby)\
**Post date:** [June 3, 2022, 3:33pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/9 "2022-06-03T15:33:41Z")

</div>

Thanks, @Victor

That formula is giving me no results. Maybe you can see what I’m doing wrong.

The user picks a date in the date picker and presses a button which updates the user

 ![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/3/a/3a30ccebdfa63ecc4c4886ce874747c8828e1ab3.png)

That then links to a new screen with the countdown timer which is setup like this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/6/9/6964f284f5b7cf12eb983edf750c319f2ce01b2b.png)

The result I get from that initial calculation is blank.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/c/3/c34cbebb89e0c2b618271ea7c62804f62e9db744.png)

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [June 3, 2022, 3:39pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/10 "2022-06-03T15:39:49Z")

</div>

Hi @Bobby,

I can’t imagine what you could be doing wrong - I have just created **the same** setup and it works for me perfectly (no need for 2 step, same formula).

Is “Seconds” a Numeric property?  
Are you 100% sure the user is logged-in? If you get to this screen with non-logged-in user then this property won’t be changed.

Best,  
Victor.

---

<div class="post-metadata">

**Author:** ![Bobby](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/bobby/32/14843_2.png) [@Bobby](https://forum.adalo.com/u/Bobby)\
**Post date:** [June 3, 2022, 9:41pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/11 "2022-06-03T21:41:21Z")

</div>

Thanks, @Victor  
No clue what I was doing wrong so I rebuilt the test and now it seems to be working.

Thanks again!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/system/32/40401_2.png) [@system](https://forum.adalo.com/u/system)\
**Post date:** [June 13, 2022, 9:41pm UTC](https://forum.adalo.com/t/countdown-timer-help/27865/12 "2022-06-13T21:41:42Z")

</div>

Closed on June 13, 2022, 9:41pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
