kotlinjodatimeandroid-jodatime

Get Monday of last week with JodaTime


I need get Monday of last week E.g

Today is 28/11/18 (wednesday)

I need get 19/11/18 (monday)

I know that I can obtain Monday of the current week with

val monday = DateTime().withDayOfWeek(DateTimeConstants.MONDAY)

Solution

  • I get it!

    DateTime().withWeekOfWeekyear(
                     DateTime().weekOfWeekyear-1)
              .withDayOfWeek(DateTimeConstants.MONDAY)
    

    I only have to get the week of the year and subtract one week and that is all