Jython helper libraries for OH3

Did you mean something like this?
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/ZonedDateTime.html

Changing from Joda to ZonedDateTime seems straight forward:

  • from org.joda.time import DateTimefrom java.time import ZonedDateTime
  • DateTime.now()ZonedDateTime.now()
  • .getHourOfDay().getHour()
  • .getMinuteOfHour().getMinute()
  • .plusMillis(x) → '.plusNanos(x * 1000000)`

and so on.

Alternatively, for even less change:

from java.time import ZonedDateTime as DateTime

Then you just need to change getHourOfDay etc to their equivalent methods of ZonedDateTime. Most of the other methods have the same name, e.g. plusMinutes().

2 Likes