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 Saryada

Founder at Kode Java Org
I am a programmer, a runner, a recreational diver, currently live in the island of Bali, Indonesia. Mostly programming in Java, Spring Framework, Hibernate / JPA. You can support my works by donating here. Thank you 🙂.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.