The getDefault() method is used to get the default TimeZone for this host. The source of the default TimeZone may vary with implementation.
Following is the declaration for java.util.TimeZone.getDefault() method.
public static TimeZone getDefault()
NA
The method call returns a default TimeZone.
NA
The following example shows the usage of java.util.TimeZone.getDefault()
package com.tutorialspoint; import java.util.*; public class TimeZoneDemo { public static void main( String args[] ) { // create default time zone object TimeZone timezonedefault = TimeZone.getDefault(); // checking default time zone value System.out.println("Default time zone is :\n" + timezonedefault); } }
Let us compile and run the above program, this will produce the following result.
Default time zone is : sun.util.calendar.ZoneInfo[id = "Asia/Calcutta",offset = 19800000,dstSavings = 0, useDaylight = false,transitions = 6,lastRule = null]