Search code examples
javadatejodatimedayofweekweek-number

Joda Time get date from Year + WeekOfYear + DayOfWeek


Is it possible with Java lib JODA Time to create a date from

  • Year
  • Week Of the Year (1 to 52 or 53, depending)
  • Day Of Week (1 to 7)?

Java has a Calendar function that can calculate it (http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html#setWeekDate%28int,%20int,%20int%29)


Solution

  •  DateTime dt = new DateTime();
     dt = dt.withYear(2015);
     dt = dt.withWeekOfWeekyear(10);
     dt = dt.withDayOfWeek(3);