[SOLVED] Formatting date (sunrise / sunset from astro)

I’m using the astro binding.
Using the instructions I was successful in adding the data to OH2.
The data is displayed correctly in the controls. Sunrise and sunset are displayed as HH:MM
I added sunrise and sunset to a panel. But in the panel both sunrise and sunset are displayed as full date/time YYYY-MM-DD HH:MM:SS:MMM+Offset.

How can I get the format in the panel as in the control ?

Try using

{{itemState('yourItem')| date:"H:mm"}}

or

{{itemValue('yourItem')| date:"H:mm"}}

if you’re on 2.0

Mikael

1 Like

Thanks for that hint.

I’m on HAB 2.1.0. Just installed it a few days ago. I hope that your proposal works here too.
I tried to use that format string in the dummy widget which I use to display the sunrise time (in the Format property)
Both formats work only partly: I can see the desired timestamp but it is embedded with stuff from the format string.
The value displayed is

{{ite43StAMte{Sunrise_Time)|28AMte:“05:43”}} (for itemState)

The display using the itemValue format string is similar :frowning:

Edit: Playing around with the format string I kicked away everything except the HH:mm (withou qoutes).
That gives the desired result.

2 Likes

Greetings: I found that if you use the following in the Widget without any quotes
your get the Year, the Month, the day, the Hour and the minutes of the sunrise. yyyy:MM:dd:HH:mm