Get first date of current month in java

前端 未结 9 1786
日久生厌
日久生厌 2020-11-29 05:28

I am trying to get to and from date where ToDate will have previous date and FromDate will have first date of the current month. For January it wou

9条回答
  •  情话喂你
    2020-11-29 06:08

    Joda Time

    If I am understanding the question correctly, it can be done very easily by using joda time

    LocalDate fromDate = new LocalDate().withDayOfMonth(1);
    LocalDate toDate = new LocalDate().minusDays(1);
    

提交回复
热议问题