OffsetDateTime getDayOfWeek() example
Description
OffsetDateTime getDayOfWeek()
gets the
day-of-week field, which is an enum DayOfWeek.
Syntax
getDayOfWeek
has the following syntax.
public DayOfWeek getDayOfWeek()
Example
The following example shows how to use getDayOfWeek
.
import java.time.DayOfWeek;
import java.time.OffsetDateTime;
/*from w ww . ja v a 2s . c om*/
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.now();
DayOfWeek l = o.getDayOfWeek();
System.out.println(l);
}
}
The code above generates the following result.