Assuming the following code...
Instant x = Instant.now();
How do I get day of week from x?
Assuming the following code...
Instant x = Instant.now();
How do I get day of week from x?
You have to convert it to ZonedDateTime
Instant.now().atZone(ZoneId.systemDefault()).getDayOfWeek()
I have awarded points to techtabu, but I ended up using atOffset instead. Here is where I ended up...
int currentDayOfWeekValue = Instant.now().atOffset(ZoneOffset.UTC).getDayOfWeek().getValue();
I am amazed how difficult the Java8 datetime libraries are. There are so many variations of similar concepts...
Is Zulu and UTC the same or different?
What is the timezone associated with Instant.now() - the results suggest Zulu?
Why can't I manipulate an Instant object like a LocalDateTime - methods are similar but different?
How are ZonedDateTime and OffsetDateTime different - they seem to be addressing the same concept.
Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
will give you the same result