DateTime Conversion (openHAB 2.x)

There is an easier way to do this. If you have a ZonedDateTime you can easily update the time using one of the LocalTime constants:

    ZonedDateTime.now().with(LocalTime.MAX)
    ZonedDateTime.now().with(LocalTime.MIDNIGHT)
    ZonedDateTime.now().with(LocalTime.MIN)
    ZonedDateTime.now().with(LocalTime.NOON)

You can already replace Joda-Time in your OH 2.5 rules today with java.time. That’s how I did it and have no issues with time when using the same rules in OH 3.

1 Like