The current version of joda-time does not support the week of the month, so you should use some workaround.
1) For example, you can use the following method:
static DateTimeFormatter FORMATTER = DateTimeFormat.forPattern("yyyy-MM_'%d'"); static String printDate(DateTime date) { final String baseFormat = FORMATTER.print(date);
Using:
DateTime dt = new DateTime(); String dateAsString = printDate(dt);
2) You can use Java 8 because the Java API supports a weekly field.
java.time.LocalDateTime date = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM_W"); System.out.println(formatter.format(date));
source share