Get first and last day of month using threeten, LocalDate

后端 未结 10 2386
鱼传尺愫
鱼传尺愫 2020-12-07 14:06

I have a LocalDate which needs to get the first and last day of the month. How do I do that?

eg. 13/2/2014 I need to get 1/2/2014 and

10条回答
  •  醉梦人生
    2020-12-07 14:50

     LocalDate monthstart = LocalDate.of(year,month,1);
     LocalDate monthend = monthstart.plusDays(monthstart.lengthOfMonth()-1);
    

提交回复
热议问题