Example usage for java.time Clock systemUTC

List of usage examples for java.time Clock systemUTC

Introduction

In this page you can find the example usage for java.time Clock systemUTC.

Prototype

public static Clock systemUTC() 

Source Link

Document

Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the UTC time-zone.

Usage

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.systemUTC();
    System.out.println(clock.instant());
}

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.systemUTC();
    System.out.println(clock.millis());
}

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.systemUTC();
    System.out.println(clock);
    System.out.println(clock.instant());
}

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.systemUTC();
    Clock clock1 = Clock.systemDefaultZone();
    System.out.println(clock.equals(clock1));
}

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.systemUTC();
    Clock clock1 = Clock.systemDefaultZone();
    System.out.println(clock.hashCode());
    System.out.println(clock1.hashCode());
}

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.systemUTC();
    System.out.println(clock.getZone());
    clock.withZone(ZoneId.systemDefault());

    System.out.println(clock.getZone());
}

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.systemUTC();
    Duration duration = Duration.ofHours(3);
    Clock newClock = Clock.offset(clock, duration);

    System.out.println(newClock.instant());
}

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.now(Clock.systemUTC());

    System.out.println(m);

}

From source file:Main.java

public static void main(String[] args) {
    LocalTime l = LocalTime.now(Clock.systemUTC());

    System.out.println(l);
}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now(Clock.systemUTC());

    System.out.println(y);

}