Need some assistance with configuration of DateTime item. In my item file I have the following two items:
DateTime Sunrise “Sunrise [%1$tH:%1$tM]” {http=“<[meteohub:10000:XPATH(/meteohub/data[@timeframe=‘actual’]/item[@sensor=‘sunrise’ and @cat=‘standard’ and @unit=‘local’])]”}
String Sunset “Sunset [%s]” {http=“<[meteohub:10000:XPATH(/meteohub/data[@timeframe=‘actual’]/item[@sensor=‘sunset’ and @cat=‘standard’ and @unit=‘local’])]”}
The String item (Sunset) works perfectly the DateTime one (Sunrise) does not. When changed to a string item it works.
The format of the sting provided by the binding is hh:mm as in 08:23 for example.
DateTimeType objects are parsed using Java’s SimpleDateFormat.parse() using the first matching pattern:
yyyy-MM-dd'T'HH:mm:ss.SSSZ
yyyy-MM-dd'T'HH:mm:ss.SSSz
yyyy-MM-dd'T'HH:mm:ss.SSSX
yyyy-MM-dd'T'HH:mm:ssz
yyyy-MM-dd'T'HH:mm:ss
Notice that 08:23 doesn’t match any of the supported date time patterns. In specific, there is no date and not seconds. A DateTime represents a specific instant in time. You can’t create a DateTime without the date.
Understood. Thank you for the response and pointing me to the documentation - sometimes its a bit challenging to find especially if the underlying concept isn’t clear understood.