1
JodaTime에서 다음 주 첫날을 계산하는 것이 가능합니까? 예를 들어, 지금은 19.05.2014 (월요일)이고 다음 주말 첫날은 토요일 24.05.204입니다.JodaTime - 다음 주말 첫째 날
JodaTime에서 다음 주 첫날을 계산하는 것이 가능합니까? 예를 들어, 지금은 19.05.2014 (월요일)이고 다음 주말 첫날은 토요일 24.05.204입니다.JodaTime - 다음 주말 첫째 날
// algorithm valid for ISO-8601-definition of a week
// (every week starting on Monday)
LocalDate date = LocalDate.now(); // in system timezone
// move after current weekend
if (date.getDayOfWeek() >= 6) {
date = date.plusDays(2);
}
// move to next Saturday (your definition of first day of a weekend)
date = date.withDayOfWeek(6);
System.out.println(date); // 2014-05-24 (if today is 2014-05-19)