I have two integers: year
and week
. I would like to construct a LocalDateTime
from these two values, where the date represents the first day of the particular week in the particular year.
I 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 that year. I can not seem to figure out how to get the first day of the first week either.
Is there any simple way to do this with the Date and Time API in Java 8?
Note: I know I could also create a workaround with answers given here, but this seems to far-fetched. Maybe it isn't, if so, let me know!