WeekFields Locale Week Start And Numbering
Week boundaries differ by locale: WeekFields exposes the first day, minimal-days rule, and week numbering so calendar buckets match user expectations.
Code
import java.time.LocalDate;
import java.time.temporal.WeekFields;
import java.util.Locale;
public class WeekBoundary {
public static void main(String[] args) {
LocalDate date = LocalDate.of(2026, 11, 14);
for (Locale locale : new Locale[] {Locale.US, Locale.ISO, Locale.FRANCE}) {
WeekFields wf = WeekFields.of(locale);
System.out.printf(
"%s: week starts %s, minDaysInFirstWeek %d, %s is week %d%n",
locale,
wf.getFirstDayOfWeek(),
wf.getMinimalDaysInFirstWeek(),
date,
date.get(wf.weekOfWeekBasedYear()));
}
}
}What the code does
WeekFields Locale Week Start And Numbering keeps everything in the class WeekBoundary and the function main.
Repetition is confined to for (Locale locale : new Locale[] {Locale.US, Locale.ISO, Locale.FRANCE}) — the rest of the file is straight-line.
Statements that matter
LocalDate date = LocalDate.of(2026, 11, 14);
WeekFields wf = WeekFields.of(locale);
Interactive Tools for This Topic
Duration ConverterConvert between human durations like 1w2d3h45m and total seconds, hours, and minutes with negative support.Duration HumanizerTurn a number of seconds into a readable duration such as 1 day, 2 hours, 3 minutes, and show the equivalent in minutes and hours.ISO 8601 Duration ParserParse ISO 8601 durations like PT1H30M into year, month, week, day, and time components with exact or approximate total seconds.ISO Week CalculatorFind the ISO 8601 week number, ISO week-year, week start and end dates, and day of year for any calendar date, with strict date validation.
FAQ
- How do you run WeekFields Locale Week Start And Numbering?
- Run it as a complete program — compile or interpret the file directly; there is nothing to install first.
Report a problem with this exampleOpens a pre-filled issue on GitHub.