I want to get number of weeks in a particular month

后端 未结 5 1074
深忆病人
深忆病人 2021-01-01 16:01

i want to get number of weeks in current month.That including the previous month\'s days in the last week and the first week days in the next month.

Something like t

5条回答
  •  轮回少年
    2021-01-01 16:21

    We can use the calendar class and then do something like

    Calendar calendar = Calendar.getInstance();
    System.out.println(calendar.getActualMaximum(Calendar.WEEK_OF_MONTH));
    

    this will return the number of weeks in the current month

提交回复
热议问题