I’m looking to create a Markup card that uses a template to show a countdown to a specific date in days.
I’ve searched the forums and so far have
{{ as_timestamp("2026-01-31") - (as_timestamp(now()) ) | timestamp_custom("%j") | int }}
but that gives me a result of “1769835577” which I’m assuming is in seconds. I looked at timestamp_custom but didn’t see a way to convert seconds to days or years / months / days.
That’s a pretty good tutorial but it does a few things the hard way (and overlooks using a few existing functions).
For example, if I need a datetime object representing today’s date at 08:30, I would use the today_at() function like this: today_at('08:30') (as opposed to using now() and the replace method).
There are also time_until() and time_since() functions for computing duration.