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

Wayan Saryada

A programmer, runner, recreational diver, currently living in the island of Bali, Indonesia. Mostly programming in Java, creating web based application with Spring Framework, JPA, etc. If you need help on Java programming you can hire me on Fiverr.
Wayan Saryada

Leave a Reply