I’m very new to Home Assistant and I’m trying to convert a time which I get from a Rest platform.
In the value_template I have this string “7:12:14 PM” and I wanted first to convert it into 24-format
I then created a template platform to convert the value stored in the Rest sensor into the format I’m looking for.
The UNIX timestamp is “seconds since the beginning of 1 Jan 1970”. The time value you’re trying to convert is being interpreted as 7PM on 1 Jan 1900, which isn’t a valid timestamp. Try this:
which fakes it into being a time on 1 Jan 2000 instead. It does seem like a lot of hoops to jump through — hopefully someone will suggest something better…
For the second part — once you have working timestamps (as above without the timestamp_custom bit), you can just subtract them then do the timestamp_custom, making sure that what you pass it is a positive number.
Hi! I tried this in my automation with two times from two helpers (input_datetime.time1 and .time2).
but it doesn’t work…
Which action is necessary?
like this: