Java Date Time - Java TimeZone.getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds)








Syntax

TimeZone.getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) has the following syntax.

public abstract int getOffset(int era,  
                                          int year,  
                                          int month,  
                                          int day,  
                                          int dayOfWeek,  
                                          int milliseconds)




Example

In the following code shows how to use TimeZone.getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) method.

/* w w  w.  j av  a2s  .  c  o  m*/

import java.util.TimeZone;

public class Main {
   public static void main( String args[] ){
       
          
      TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");
      
      // checking offset value       
      System.out.println("Offset value is :" + timezone.getOffset(1, 2011, 2, 2, 2, 300));
   }    
}

The code above generates the following result.