Java SimpleTimeZone.getOffset(long date)

Syntax

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

public int getOffset(long date)

Example

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


/*from ww  w.jav a  2s  .  c  o  m*/
import java.util.Calendar;
import java.util.SimpleTimeZone;

public class Main {
   public static void main( String args[] ){
       
      SimpleTimeZone stobj = new SimpleTimeZone(720,"US");
      
      // get offset
      int offset=stobj.getOffset(Calendar.ZONE_OFFSET); 
      
      // check offset value       
      System.out.println("Offset is : " + offset);
   }     
}

The code above generates the following result.