Saturday, September 6, 2025
HomeLanguagesJavaSimpleTimeZone getRawOffset() method in Java with Examples

SimpleTimeZone getRawOffset() method in Java with Examples

The getRawOffset() method of SimpleTimeZone class is used to get the GMT offset for this time zone.
Syntax:

public int getRawOffset()

Parameters: The function does not accepts any parameters.

Return Value: It returns the GMT offset value in milliseconds.

Exception: The function does not throws any exceptions.

Program below demonstrates the above mentioned function:

Program 1:




// program to demonstrate the
// function java.util.SimpleTimeZone.getRawOffset()
import java.util.*;
  
public class GFG {
  
    public static void main(String[] args)
    {
  
        // create simple time zone object
        SimpleTimeZone obj
            = new SimpleTimeZone(580, "INDIA");
  
        // get raw offset value and print
        System.out.println("Raw Offset is = "
                           + obj.getRawOffset());
    }
}


Output:

Raw Offset is = 580

Program 2:




// program to demonstrate the
// function java.util.SimpleTimeZone.getRawOffset()
  
import java.util.*;
  
public class GFG {
  
    public static void main(String[] args)
    {
  
        // create simple time zone object
        SimpleTimeZone obj
            = new SimpleTimeZone(640, "INDIA");
  
        // get raw offset value and print
        System.out.println("Raw Offset is = "
                           + obj.getRawOffset());
    }
}


Output:

Raw Offset is = 640
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32270 POSTS0 COMMENTS
Milvus
82 POSTS0 COMMENTS
Nango Kala
6639 POSTS0 COMMENTS
Nicole Veronica
11805 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11869 POSTS0 COMMENTS
Shaida Kate Naidoo
6754 POSTS0 COMMENTS
Ted Musemwa
7029 POSTS0 COMMENTS
Thapelo Manthata
6705 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS