TimeZone getRawOffset() Method in Java with Examples
The getRawOffset() method of TimeZone class in Java is used to know the amount of time in milliseconds needed to be added to the UTC to get the standard time in this TimeZone.
Syntax:
public abstract int getRawOffset()
Parameters: The method does not take any parameters.
Return Value: The method returns in milliseconds the amount of time needed to be added to the UTC to get the standard time in this TimeZone.
Below programs illustrate the working of getRawOffset() Method of TimeZone:
Example 1:
// Java code to illustrate getRawOffset() method import java.util.*; public class TimeZoneDemo { public static void main(String args[]) { // Creating a TimeZone TimeZone offtime_zone = TimeZone.getTimeZone( "Pacific/Pago_Pago" ); // Knowing the rawOffset time System.out.println( "The rawOffset time is: " + offtime_zone.getRawOffset()); } } |
The rawOffset time is: -39600000
Example 2:
// Java code to illustrate getRawOffset() method import java.util.*; public class TimeZoneDemo { public static void main(String args[]) { // Creating a TimeZone TimeZone offtime_zone = TimeZone.getTimeZone( "Europe/Rome" ); // Knowing the rawOffset time System.out.println( "The rawOffset time is: " + offtime_zone.getRawOffset()); } } |
The rawOffset time is: 3600000
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html#getRawOffset()
Recommended Posts:
- SimpleTimeZone getRawOffset() method in Java with Examples
- TimeZone clone() Method in Java with Examples
- TimeZone getOffset(int, int, int, int, int, int) Method in Java with Examples
- TimeZone getTimeZone() Method in Java with Examples
- TimeZone observesDaylightTime() method in Java with Examples
- TimeZone getDisplayName() Method in Java with Examples
- TimeZone useDaylightTime() method in Java with Examples
- TimeZone getDefault() Method in Java with Examples
- TimeZone setDefault() Method in Java with Examples
- TimeZone setRawOffset() Method in Java with Examples
- TimeZone inDaylightTime() method in Java with Examples
- TimeZone setID() Method in Java with Examples
- TimeZone hasSameRules() Method in Java with Examples
- TimeZone getAvailableIDs() Method in Java with Examples
- TimeZone getID() Method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.