Java TimeZone getRawOffset() Example

TimeZone class getRawOffset() method example. This example shows you how to use getRawOffset() method.


Syntax is : public abstract int getRawOffset()
Method returns the amount of time in milliseconds to add to UTC to get standard time in this time zone. Because this value is not affected by daylight saving time, it is called raw offset.

Here is the code.
/**
 * @(#) GetRawOffsetTimeZone.java
 * A class representing use of method getRawOffset() of TimeZone
 class in java.util Package.
 * @Version  27-May-2008
 @author   Rose India Team
 */
import java.util.*;

class GetRawOffsetTimeZone {
    public static void mainString args[] ){
        // Create object of TimeZone class. 
        TimeZone obj = TimeZone.getTimeZone("America/Los_Angeles");
        // getRawOffset() method call for specified time zone.
      int offset = obj.getRawOffset();
        System.out.println("Raw Offset of this time zone is : " + offset);
  }
}

Output of the program.
Raw Offset of this time zone is : -28800000

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US