How do I get host’s default timezone 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("nDefault Time Zone ID: " + id);

The default timezone id for this host is:

Default Time Zone ID: Asia/Shanghai

Wayan Saryada

Programmer, runner, recreational diver, live in the island of Bali, Indonesia. Mostly programming in Java, creating web based application with Spring Framework, Hibernate / JPA.

Leave a Reply