dayOfWeek

dayOfWeek returns the day of the week, as a java.time.DayOfWeek value, for an input date-time in the specified time zone. To get the day of the week as an integer, with 1 being Monday and 7 being Sunday, use dayOfWeekValue instead.

Syntax

Parameters

ParameterTypeDescription
instantInstant

The instant for which to find the day of the week.

timeZoneZoneId

The time zone to use when interpreting the date-time.

dateTimeZonedDateTime

The zoned date-time for which to find the day of the week.

localDateTimeLocalDateTime

The local date-time for which to find the day of the week.

localDateLocalDate

The local date for which to find the day of the week.

Returns

Returns the day of the week as a java.time.DayOfWeek value, such as THURSDAY.

Examples