Java Date Time - Java TimeZone.getDefault()








Syntax

TimeZone.getDefault() has the following syntax.

public static TimeZone getDefault()

Example

In the following code shows how to use TimeZone.getDefault() method.

/*w  ww. ja  va  2s. co  m*/

import java.util.TimeZone;

public class Main {
   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);
   }    
}

The code above generates the following result.