Java Date Time - Java TimeZone.getOffset(long date)








Syntax

TimeZone.getOffset(long date) has the following syntax.

public int getOffset(long date)

Example

In the following code shows how to use TimeZone.getOffset(long date) method.

//  ww w.ja v a  2  s . c o  m

import java.util.Calendar;
import java.util.TimeZone;

public class Main {
   public static void main( String args[] ){
       
          
      TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");
      
      // checking offset value for date      
      System.out.println("Offset value:" + timezone.getOffset(Calendar.ZONE_OFFSET));
   }    
}

The code above generates the following result.