Get first day of a particular week in Joda-Time? java

java, jodatime

Solution

Try LocalDate.withDayOfWeek:

LocalDate now = new LocalDate();
System.out.println(now.withDayOfWeek(DateTimeConstants.MONDAY)); //prints 2011-01-17
System.out.println(now.withDayOfWeek(DateTimeConstants.SUNDAY)); //prints 2011-01-23

Problem

In Joda-Time, is there a way to get the date of the first day of the week(monday). for instance i want to find out what date was this weeks monday based on todays current date 21/01/11 Cheers in advance. edit: i also wish to find the date for the end of the week i.e sunday's date. cheers

Original source

Related problems