get week number from localdate java

Solutions on MaxInterview for get week number from localdate java by the best coders in the world

showing results for - "get week number from localdate java"
Myron
10 Jul 2018
1LocalDate date = LocalDate.now();
2TemporalField woy = WeekFields.of(Locale.getDefault()).weekOfWeekBasedYear(); 
3int weekNumber = date.get(woy);
4
Charlette
16 Jul 2019
1LocalDate date = ...;
2// Or use a specific locale, or configure your own rules
3WeekFields weekFields = WeekFields.of(Locale.getDefault()); 
4int weekNumber = date.get(weekFields.weekOfWeekBasedYear());
5