Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.zone.ZoneOffsetTransition;
import java.time.zone.ZoneRules;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        ZoneId usChicago = ZoneId.of("America/Chicago");
        System.out.println("Zone ID:  " + usChicago.getId());

        ZoneRules rules = usChicago.getRules();
        System.out.println("isFixedOffset(): " + rules.isFixedOffset());
        ZoneOffset offset = rules.getOffset(now);
        System.out.println("Zone offset: " + offset);

        List<ZoneOffsetTransition> transitions = rules.getTransitions();
        System.out.println(transitions);

    }
}