The getOffset() method of TimeZone class in Java is used to know the offset value of this TimeZone at a specific date from the UTC or the Universal Time Coordinated.
public int getOffset(long in_date)
Parameters: The method accepts one parameter, in_date of long type that refers to the actual date represented in milli-seconds since 1st January 1970 at 00:00:00 GMT.
Return Value: The method returns the ID of the TimeZone.
Below programs illustrate the working of getOffset() Method of TimeZone:
The Offset Value is:3600000
The Offset Value is:-39600000
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.