Se7enair
(Se7enair)
1
I use this template for a countdown.
For my understanding, it should change the result at midnight. But it changes at 11am.
Can somebody tell me why?
'{{ (( as_timestamp(strptime("2022-05-16 00:00:00" , "%Y-%m-%dT%H:%M:%S")) - as_timestamp(now()) )/ (3600*24)) | round(0) }}'
Assuming you are on different timezone other than utc, it is better to use as_local
rather than as_timestamp
Local should return local time
Timestamp should return utc time
Se7enair
(Se7enair)
3
Seems to work
'{{ ( as_datetime("2022-05-16 00:00:00.0+01:00") - as_local(now()) ) }}'
but it evalutes as '124 days, 1:46:49.112656'
is there a way to recieve only the days as a integer?
petro
(Petro)
4
{{ ( as_datetime("2022-05-16 00:00:00.0+01:00") - as_local(now()) ).days }}
keep in mind it could be upwards of 24 hours off. I.e, it’ll be zero days at that point.
Se7enair
(Se7enair)
5
Its working, perfect. Thank you!