# Trying to add a count down to a date

I’m trying to add a count down to a specific date, so I know how many days I have left to get ready, but I’m having trouble figuring out how to do it. I tried taking the “countdown to midnight” coding and changing some of the wording and part of the code so that it says “Leaving in \$tf(0h0m0sa10d, D)\$ days” instead of “Midnight in \$tf(0h0m0sa1d, hh:mm:ss)\$”, which gives me “Leaving in 9 days”, always 1 less than the number I put in, but it doesn’t seem to be counting down! How do I remedy this? Help me, please!

What you have will only count full days. This means that the current day will not be counted. This is evident when you use \$tf(0h0m0sa1d, D)\$ which will output “0” since the D value of something like 12:05:20 is 0. You can just add 1 day to your formula to compensate for this.

Yeah I understood that part… mostly, but it’s still not counting down. Every day I looked at my screen it still said 9 days… actually for some reason it decided to change to 2 weeks, realized I must have accidents erased the comma between the first half and the D. Then, while I was messing with it, I though, which was dangerous, so I opened a window. I deleted the “hh:mm:ss”, and the “, D”, and just used the simplest form of it as “Leaving in \$tf(a4d)\$”, but I still don’t know if it’s going to decide to count down or not. Also, do I need the “/” between “a” and the number or not? It doesn’t seem to make a difference. I tried to read the teensy tiny writing explaining everybody at the bottom of the box, but I’m blind as a bat! I need a manual in regular sized fonts!

Thanks for your explanation, tho! It did help me understand it bit more.

Here’s the official documentation:
TF - time span | Kustom HQ

And this might help too, it’s a bit more extensive in explaining:
A guide to Kode basics (theothertored.github.io)

I’ve messed around a bit myself and came up with this:

`\$tf(dp(17d08M2024y12h00m00s)-dp(df(dd MMMM yyyy hh:mm:ss)), "D 'days' hh 'hours' mm 'minutes' ss 'seconds'")\$`

It will count down, but only uptil the minutes. It won’t count down in seconds.
Not sure if that’s a problem for you and if there is a workaround for that.

Short explanation:
`17d08M2024y12h00m00s` is the date and time you want to count down to
`dd MMMM yyyy hh:mm:ss` gets the current date and time
`D 'days' hh 'hours' mm 'minutes' ss 'seconds'` makes up the output text

2 Likes

Oh my goodness, thank you so much! I’ve been very much busy again, but will need this regularly, so this is great! I do much better when things are explained in detail, so the detailed explanation is perfect!

1 Like