Countdown extension

extension

#1

Hello everyone, I’ve created my first extension for App Inventor woot! this extension provides a variety of methods for getting the duration between two dates, I know this is possible with the clock component but this simplifies it a bit more and provides some additional methods.

There are 10 different methods available for getting the duration for a variety of units such as days, weeks, months, years .etc most of these require a startDate and endDate in the form of a String in the following format “MM/DD/YYYY hh:mm:ss”

There are also two methods which will return a countdown as a list which you can see in the following examples of a countdown to Google I/O 2020 :grin:

Which displays in app like so:

Download countdown.aix


Calculating duration between two times
Add Countdown in my app
Timer that doesn't involve implementing clock
#2

Great start @LukeGackle! Keep up the awesome work.


#3

Great!!! Works fine.


#4

Thanks! This is just my first extension, hoping to create some much more awesome extensions if all goes well :grin:


#5

Waooo another useful and simplified Extension. Well done man. keep it going. we hope for more greater works and extensions from you. i love it and will definitely use it in one of my projects :heart_eyes:


#6

Nice work @LukeGackle, looking forward to adding this to the Thunkable Extensions Directory!


#7

@LukeGackle Great & simple extension. Thanks for contributing for the community!


#8

Thanks for this extension. It will be very useful for me.
Is it possible to compare time, do something when time is up?
For example disable a feature when license expires. Please show me a simple block.


#9

You might want to checkout this


#10

Hi @Patrick_Elisha

At this stage my countdown extension doesn’t have any blocks for comparing times but I will take that feedback on board as it may be a useful function to implement in a future update.

You may be able to use some of the functions in the clock component to compare times, otherwise for the time being I’d suggest trying the method @Red_Panda has posted above.


#11

Thank you. This will be helpful.


#12

Thank You.


#13

In an effort to ease back into Thunkable and computer related work, I have released a updated version of the countdown extension.

Version 2 brings a timer, as well as some simple methods to compare times including IsDateBefore, IsDateAfter, and IsDateEqual which you may fine useful @Patrick_Elisha, and there is an example of this on my blog post.

See my blog post for further information and extension download at http://thunkableblocks.blogspot.com.au/2017/05/countdown-extension.html


#14

Hello, could you help me with a problem I had. I need a way to count the time in hours from the current time to a pre-set time tomorrow. Example: I need to know the time in hours of the current time (21:26) to a pre-set time of tomorrow (12:00 for example) that would result in a value of 14 hours.
Basically my app will have a notification system, and I need to know the time remaining until the next notification


#15

This is pretty convoluted but it works and gets the result you need I’m sure there’s a better way to do this but for now this is what I’ve come up with:


#16

But what if the current time is the same day as the notification. example, the current time is 8:00, and the notifier’s schedule is 12:00, but both are on the same day, so the time until the notifier is 4 hours remaining


#17

You are correct that is an issue, but I’m sure it’s something you might be able to work out with an if statement, this is only something that I very quickly whipped up hoping that it might give you some ideas as to how you might solve the problem.

Perhaps something like if the current time is after 12 then add day, else don’t add a day. See if you can come up with a solution :grin:


#18

I got it, I’ll try it here. Thank you very much


#19

Hello LukeGackle I want to countdown but in a different way, my application after passing a level I intend that a countdown of 1 hour appears on the page, and after the countdown finish the player can advance to the next level. but when the player closes the app and reopens before completing 1 hour the count down is not there and the player can continue to play normally. Does any way to countdown continue after closing the application?
thank you


#20

Try to have a look at the latest version of my extension, you can use the timer method which continues when you hide the application such as hitting the home button, however it may not continue when you actually close the app from your recent apps.

Documentation is available here:

Other option is to save the date and time the countdown should go to in tinydb or something, and use a clock component to update the countdown.

With this method you’d use screen initialise to check if it’s still counting down and start the clock again.