Example usage for java.time DayOfWeek from

List of usage examples for java.time DayOfWeek from

Introduction

In this page you can find the example usage for java.time DayOfWeek from.

Prototype

public static DayOfWeek from(TemporalAccessor temporal) 

Source Link

Document

Obtains an instance of DayOfWeek from a temporal object.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.getValue());
    dayOfWeek = dayOfWeek.minus(2);//from   ww  w.j  a va  2s .co m
    System.out.println(dayOfWeek.getValue());
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.getValue());
    dayOfWeek = dayOfWeek.plus(2);//from w  w  w . ja v  a  2s  . c  o m
    System.out.println(dayOfWeek.getValue());
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.name());
    System.out.println(dayOfWeek.getValue());
    System.out.println(dayOfWeek.ordinal());
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, 6, 21);
    System.out.println(localDate);
    DayOfWeek dayOfWeek1 = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek1);
    int intValue = dayOfWeek1.getValue();
    System.out.println(intValue);
    DayOfWeek dayOfWeek2 = localDate.getDayOfWeek();
    System.out.println(dayOfWeek2);
    DayOfWeek dayOfWeekFromInteger = DayOfWeek.of(7);
    System.out.println(dayOfWeekFromInteger);
    DayOfWeek dayOfWeekAdded = dayOfWeekFromInteger.plus(1);
    System.out.println(dayOfWeekAdded);
    DayOfWeek dayOfWeekSubtracted = dayOfWeekFromInteger.minus(2);
    System.out.println(dayOfWeekSubtracted);
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.get(ChronoField.DAY_OF_WEEK));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.range(ChronoField.DAY_OF_WEEK));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.isSupported(ChronoField.DAY_OF_YEAR));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.getLong(ChronoField.DAY_OF_WEEK));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);

    Temporal i = dayOfWeek.adjustInto(LocalDate.of(2014, Month.MAY, 22));
    System.out.println(i);/*  w  w  w  . j  av a 2s . c  om*/

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.getDisplayName(TextStyle.FULL, Locale.CANADA));
    System.out.println(dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.CANADA));
    System.out.println(dayOfWeek.getDisplayName(TextStyle.NARROW, Locale.CANADA));
}