How to get dates of a week (I know week number)?

后端 未结 5 1994
猫巷女王i
猫巷女王i 2020-12-01 11:16

I know the week number of the year, a week is start from Sunday, then Monday, Tuesday...,Saturday.

Since I know the week number, what\'s the efficient way to get the

5条回答
  •  温柔的废话
    2020-12-01 11:28

    You can use the joda time library

    int weekNumber = 10;
    DateTime weekStartDate = new DateTime().withWeekOfWeekyear(weekNumber);
    DateTime weekEndDate = new DateTime().withWeekOfWeekyear(weekNumber + 1);
    

提交回复
热议问题