使用 JodaTime 获取上周的星期一
Get Monday of last week with JodaTime
我需要得到上周的星期一,例如
Today is 28/11/18 (wednesday)
I need get 19/11/18 (monday)
我知道我可以通过
获得本周的星期一
val monday = DateTime().withDayOfWeek(DateTimeConstants.MONDAY)
我明白了!
DateTime().withWeekOfWeekyear(
DateTime().weekOfWeekyear-1)
.withDayOfWeek(DateTimeConstants.MONDAY)
我只需要得到一年中的第几周减去一周就可以了
我需要得到上周的星期一,例如
Today is 28/11/18 (wednesday)
I need get 19/11/18 (monday)
我知道我可以通过
获得本周的星期一val monday = DateTime().withDayOfWeek(DateTimeConstants.MONDAY)
我明白了!
DateTime().withWeekOfWeekyear(
DateTime().weekOfWeekyear-1)
.withDayOfWeek(DateTimeConstants.MONDAY)
我只需要得到一年中的第几周减去一周就可以了