I have two integers: year and week . I would like to build LocalDateTime from these two values, where the date represents the first day of a particular week in a particular year.
I have already tried this:
LocalDateTime ldt = LocalDateTime.of(year, 1, 1, 0, 0).plusWeeks(week-1);
This does not give the correct result, because the first day of the year is not always the beginning of the first week of this year. I canβt figure out how to get the first day of the first week.
Is there an easy way to do this using the Date and Time APIs in Java 8?
Note. I know that I could also create a workaround with answers here , but that seems far-fetched. Maybe this is not so, if so, let me know!
java datetime java-8 java-time
bashoogzaad
source share