java.util.SimpleTimeZone.getRawOffset() Method


Advertisements


Description

The getRawOffset() method is used to get the GMT offset for this time zone.

Declaration

Following is the declaration for java.util.SimpleTimeZone.getRawOffset() method.

public int getRawOffset()

Parameters

  • NA

Return Value

The method call returns the GMT offset value in milliseconds.

Exception

  • NA

Example

The following example shows the usage of java.util.SimpleTimeZone.getRawOffset()

package com.tutorialspoint;

import java.util.*;

public class SimpleTimeZoneDemo {
   public static void main( String args[] ){
   // create simple time zone object 
   SimpleTimeZone stobj = new SimpleTimeZone(720,"INDIA");
      
   // get raw offset
   int offset=stobj.getRawOffset(); 
      
   // check raw offset value       
   System.out.println("Raw Offset is : " + offset);
   }    
}

Let us compile and run the above program, this will produce the following result.

Raw Offset is : 720

java_util_simpletimezone.htm

Advertisements