Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I need some help.
- -Nether_Portal-
- Scratcher
34 posts
I need some help.
How do you make a timer countdown to a certain date? (advanced)
- CatClawz_
- Scratcher
100+ posts
I need some help.
How do you make a timer countdown to a certain date? (advanced)pretty simple, lemme write some code and ill get back to you :33
Last edited by CatClawz_ (Tomorrow at 03:45:00)
when [PANIC v] key pressedHe/Him/His only please!! <33
PANIC
Check out my Snap! profile!! :>
- CatClawz_
- Scratcher
100+ posts
I need some help.
Alright never mind a little harder than i thoughtHow do you make a timer countdown to a certain date? (advanced)pretty simple, lemme write some code and ill get back to you :33
basically though you just gotta use the
(current [ v])block, and some sort of the date you're counting to minus that date
sorry that was a horrible explanation
Last edited by CatClawz_ (Tomorrow at 03:45:00)
when [PANIC v] key pressedHe/Him/His only please!! <33
PANIC
Check out my Snap! profile!! :>
- -Nether_Portal-
- Scratcher
34 posts
I need some help.
TYSM!!Alright never mind a little harder than i thoughtHow do you make a timer countdown to a certain date? (advanced)pretty simple, lemme write some code and ill get back to you :33
basically though you just gotta use the(current [ v])block, and some sort of the date you're counting to minus that date
sorry that was a horrible explanation
Last edited by -Nether_Portal- (May 13, 2024 08:33:29)
- deck26
- Scratcher
1000+ posts
I need some help.
There are lots of countdown projects if you search. But do you want a global countdown so it is the same for everyone around the world or is it a local version so the different timezones see different data?
In the first case the ‘days since 2000’ block is useful since it uses UTC time and is the same for everyone. If you can work out what value that block will return at the event time you just need to report the difference between that and the current value.
In the second case it can still be useful using that block but you need to adjust for local time. For example if your timezone is 1 hour ahead of UCT you may want to do as above but then subtract one hour from the resulting value.
In the first case the ‘days since 2000’ block is useful since it uses UTC time and is the same for everyone. If you can work out what value that block will return at the event time you just need to report the difference between that and the current value.
In the second case it can still be useful using that block but you need to adjust for local time. For example if your timezone is 1 hour ahead of UCT you may want to do as above but then subtract one hour from the resulting value.
- -Nether_Portal-
- Scratcher
34 posts
I need some help.
There are lots of countdown projects if you search. But do you want a global countdown so it is the same for everyone around the world or is it a local version so the different timezones see different data?I'm trying to do this countdown for EDT, in which where I am. My timezone (EDT) is four hours before UCT. What do I do exactly?
In the first case the ‘days since 2000’ block is useful since it uses UTC time and is the same for everyone. If you can work out what value that block will return at the event time you just need to report the difference between that and the current value.
In the second case it can still be useful using that block but you need to adjust for local time. For example if your timezone is 1 hour ahead of UCT you may want to do as above but then subtract one hour from the resulting value.
- deck26
- Scratcher
1000+ posts
I need some help.
Search for countdown projects and try to work it out! You'll learn far more by at least trying yourself and asking for help when you get stuck than you will by just asking someone else to write your code for you.
- Rakono
- Scratcher
49 posts
I need some help.
How do you make a timer countdown to a certain date? (advanced)
set [countdown] to [((how many seconds since 2000 to the day you selected) - ((days since 2000) * (86400)-(3600*4)))]
Last edited by Rakono (May 13, 2024 10:21:49)
- deck26
- Scratcher
1000+ posts
I need some help.
But in a nutshell.
Imagine the days since 2000 block only returned a value in whole days and on your target date you would expect it to return 2587 and it currently returns 2526 your countdown would just subtract one value from the other to get the number of days until the target.
So if you can work out the value for your target time it will include a fractional part - I have a project which takes a date and gives the value for that day. So the same applies, you just need to convert the difference to days, hours, minutes etc.
Imagine the days since 2000 block only returned a value in whole days and on your target date you would expect it to return 2587 and it currently returns 2526 your countdown would just subtract one value from the other to get the number of days until the target.
So if you can work out the value for your target time it will include a fractional part - I have a project which takes a date and gives the value for that day. So the same applies, you just need to convert the difference to days, hours, minutes etc.
Last edited by deck26 (May 13, 2024 09:15:33)
- Discussion Forums
- » Help with Scripts
- » I need some help.