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

后端 未结 6 1793
猫巷女王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:38

    Use the following instead

    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.MINUTE,10);
    Date date =   calendar.getTime();
    

提交回复
热议问题