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.


//from   w  ww  .  j  a  v a 2 s.co 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.