Countdown from "created date" in collection?

Hi, I’m new to adalo and trying to do a countdown from a specific date. What i would like to do is:

  1. user uploads an image
  2. I will do some processing of the image in the background
  3. I want to display to the user that his image will be available in 7 days from the day it was uploaded.

I’m using a horizontal card list and want to show “Image available in Xdays, Y hours, Z seconds” as the Title in my bottom bar text. How do i go about displaying “7 days from now minus current date/time”? This seems like it should be fairly easy to accomplish, but I haven’t seemed to be able to get it to work. I tried custom formulas and I got a really odd -2.983767311 type of integer. I tried changing the display and i got a date from 1969. Any thoughts on how to make this work?

Hello, well basically it can be done by creating a new date property in the Users collection. Call this new property “End date”. And set this date to be when the image expiration day ends. Then when “End date” is equal to “Current time” => the image won’t be displayed.

Hi @dgarnett,

Welcome to the community :muscle:

Correct? :eyes:

Clonable Link

Thank you

Thanks Dilon, this got me part of the way there, but things are still not working as intuitively as I would have expected. In this example that you coded up, the Days, hours and seconds that count down are all the same value. eg, 5 days = 120 hours = 466xxx seconds. What I need is for the display to show: 5 days, 22 hours and 15 minutes (as an example).

So let’s say i create an image on Jan 1. It needs to be available on Jan 8 (7 days later). 1 minute after image upload i want the user to see: Available in 6 days, 23 hours and 59 minutes. 2 days, 1 hour and 13 minutes after image is created, i need the user to see: Available in 4 days, 22 hours and 47 minutes. etc.

Thanks again for the help.

@dgarnett , you mean you want to show minutes instead of seconds? Maybe a full one example?

@dilon_perera Very simply, what i need is “Date/Time 1” MINUS “Date/Time2” formatted in DD:HH:MM:SS output

image created date: Jan 1 2023 12:00am
image available date: Jan 8 2023 12:00am (adding 7 days to image created date)

Let’s say right now is Jan 1 2023 12:01am. I want the user to see: “Image will be processed for you in 6 days, 23 hours, 59 minutes, XX Seconds.”

Let’s say right now is Jan 5 2023 6:23pm. i want the user to see: “Image will be processed for you in 2 days, 5 hours, 47 minutes, XX Seconds”

Basically i’m looking to display the amount of time left that a user has to wait between two times. Think of it as a turn around time timer.

:no_mouth:

@dilon_perera Nope… Let me try to explain this another way. There are two dates 7 days apart. Subtracting those dates equals 604800 seconds.

I need the display to convert 604800s into 6d:23h:59m:59s and countdown that way, NOT countdown 604800>604799>604788 etc.

Eg: 6d:23h:59m:58s > 6d:23h:59m:57s > 6d:23h:59m:56s

What your example provides is showing each day/hour/min/second as the equivalent 7 days:

Look at the “seconds”, that shows the TOTAL number of seconds in the 7 day countdown, NOT a human readable 60s that turns into a minute and then restarts at 59s.

Think about it like any mobile game where you have to wait for a reward or are capturing a building or whatever:

I need my user to wait 7 days before the “reward” between uploading their image and receiving the processed transformed image and i need it to show the user that there is XXdays:YYhours:ZZmins:AAsecs left to wait until their “reward” is granted.

I’ve got an API that could return exactly what you want but you’ll need to make it into an automatic action and you’ll be billed every time a call is made i.e. every time a user checks in on their elapsed time, would that work for u

Aha! Now I got it @dgarnett! I will update the app and share it here!

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