ZoneId getRules() example

Description

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;
//www .j a  v  a  2 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.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset