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.


//from   w ww.j  av  a 2  s .  com

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.