Example usage for java.time LocalDateTime isSupported

List of usage examples for java.time LocalDateTime isSupported

Introduction

In this page you can find the example usage for java.time LocalDateTime isSupported.

Prototype

@Override 
public boolean isSupported(TemporalUnit unit) 

Source Link

Document

Checks if the specified unit is supported.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime now = LocalDateTime.now();
    System.out.println(now.isSupported(ChronoField.YEAR));
    System.out.println(now.isSupported(ChronoField.HOUR_OF_DAY));

    System.out.println(ChronoField.YEAR.isSupportedBy(now));
    System.out.println(ChronoField.HOUR_OF_DAY.isSupportedBy(now));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 01);

    System.out.println(a.isSupported(ChronoUnit.DAYS));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 01);

    System.out.println(a.isSupported(ChronoField.DAY_OF_WEEK));
}