Joda time : How to convert String to LocalDate?

前端 未结 6 1232
旧巷少年郎
旧巷少年郎 2020-12-05 17:05

How to specify the format string to convert the date alone from string. In my case, only the date part is relevant

Constructing it as DateTime fails:

6条回答
  •  甜味超标
    2020-12-05 17:28

    You can use LocalDate.of with the year, month and day passed as separate arguments:

    LocalDate date1 = LocalDate.of(2009, 4, 17);
    LocalDate date2 = LocalDate.of(2009, Month.APRIL, 17);
    

提交回复
热议问题