How do I get Host Default Time Zone ID?

package org.kodejava.example.util;

import java.util.TimeZone;

public class HostDefaultTimeZone {
    public static void main(String[] args) {
        // Gets the default TimeZone ID for this host
        String id = TimeZone.getDefault().getID();
        System.out.println("Default Time Zone ID: " + id);
    }
}

The default timezone id for this host is:

Default Time Zone ID: Asia/Shanghai

Wayan

Programmer, runner, recreational diver, live in the island of Bali, Indonesia. Mostly programming in Java, Spring Framework, Hibernate / JPA. Support me by donating.

Leave a Reply