Java Date Time - Clock getZone() example








Clock getZone() gets the time-zone used to create dates and times.

Syntax

getZone has the following syntax.

public abstract ZoneId getZone()

Example

The following example shows how to use getZone.

import java.time.Clock;

public class Main {
  public static void main(String[] args) {
    Clock clock = Clock.systemDefaultZone();
    
    System.out.println(clock.getZone());
  }
}

The code above generates the following result.