Change rules not to use DateTime before migrating to OH3?

I am planning to migrate from OH2.5 to 3 shortly. I would like to update my Extend rules before the migration, if possible. Is it possible to use the new Java time objects and calculations in OH2.5? If so, what do I need to import? Will this save me effort or is it better to migrate and change the rules later on?

I have read the 197 posts on DateTime Conversion (openHAB 3.x) but I am no wiser if the changes could be done whilst running OH2.5.

Based on the first line of that post, I don’t think it’s possible. It’s an indirect way of saying it that would have been easy to miss.

Saying that, there’s no harm in changing one rule, saving it, and seeing what happens in your log. At the very least, you can confirm the answer for anyone else who has a similar thought. :wink:

My feeling is that it will be more effort to convert them beforehand. Either way, you’ll need to import the text files into OH3 and then check them for errors. At least if you do that while the system is running, the log will give you feedback.

You can use zonedDateTime in OH2 DSL rules, I think you have to do an import.
It’s of limited practical use, because ‘now’ that gets a lot of use, will still be a Joda. Persistence functions too.

1 Like

Thanks. If I follow you @rossko57, it makes more sense to make the changes after the upgrade and not ahead of it. Correct me if I am wrong. Thank you.

Well, you can use Javatime/ ZonedDateTime in OH2 rules, but the OH2 framework will still be working with Joda. So you’d then need to add a layer of conversion to and fro, which in turn is no use in OH3.