Motorola devices : org.threeten.bp.DateTimeException when parsing a date in ThreeTen

后端 未结 6 1794
猫巷女王i
猫巷女王i 2021-02-11 12:23

I have a very weird behaviour on some Motorola devices where LocalDateTime.now() is returning 0000-00-00T00:00:00.0 with ThreeTenABP.

The code

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-11 12:36

    You can see the error saying "Invalid value for MonthOfYear (valid values 1 - 12)" MonthOfYear starts with zero(0). So wherever you are using MonthOfYear add 1. so it will be in correct format.

提交回复
热议问题