java – Formatting a duration in Java 8 / jsr310

There is no period / duration-formatter in jsr-310, other than JodaTime. Not all features of JodaTime have been converted to JSR-310 (for example also not PeriodType). And conversely, JSR-310 has some features that aren’t available in JodaTime (e.g. localized weekday numbers or strategy model approach with regulators).

It might happen that Java 9 introduces some sort of built-in period formatting (read something about this from S. Colebourne).

Conclusion: JSR-310 and JodaTime are not fully compatible with each other, so a lot of work can be required. I wouldn’t be so thrilled with the migration as soon as possible. Do you need special JSR-310 functions that are not offered by JodaTime?

Additional Note: You should also be aware that the joda period (which includes all units from years to seconds) is not fully compatible with jsr310 period (years, months, days only) or jsr310 duration (hours, minutes, seconds only and fraction seconds).

Leave a comment