Java Date Time - ZoneId getRules() example








ZoneId getRules() gets the time-zone rules for this ID allowing calculations to be performed.

Syntax

getRules has the following syntax.

public abstract ZoneRules getRules()

Example

The following example shows how to use getRules.

import java.time.ZoneId;
import java.time.zone.ZoneRules;
/*from   ww  w.j a v  a2  s  .  c  o  m*/
public class Main {
  public static void main(String[] args) {
    ZoneId z = ZoneId.systemDefault();
    ZoneRules r = z.getRules();
    System.out.println(r);
  } 
}

The code above generates the following result.