TimeZone getOffset() Method in Java with Examples Last Updated : 02 Jan, 2019 Comments Improve Suggest changes Like Article Like Report 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. Syntax: 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: Example 1: Java // Java code to illustrate getOffset() method import java.util.*; public class TimeZoneDemo { public static void main(String args[]) { // Creating a TimeZone TimeZone offtime_zone = TimeZone.getTimeZone("Europe/Rome"); // Checking the offset for the systems date System.out.println("The Offset Value is:" + offtime_zone .getOffset(Calendar.ZONE_OFFSET)); } } Output: The Offset Value is:3600000 Example 2: Java // Java code to illustrate getOffset() method import java.util.*; public class TimeZoneDemo { public static void main(String args[]) { // Creating a TimeZone TimeZone offtime_zone = TimeZone.getTimeZone("Pacific/Pago_Pago"); // Checking the offset for the systems date System.out.println("The Offset Value is:" + offtime_zone .getOffset(Calendar.ZONE_OFFSET)); } } Output: The Offset Value is:-39600000 Reference: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html#getOffset() Comment More infoAdvertise with us Next Article TimeZone getOffset() Method in Java with Examples chinmoy lenka Follow Improve Article Tags : Misc Java Java - util package Java-Functions Java-TimeZone +1 More Practice Tags : JavaMisc Similar Reads 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 ret 1 min read SimpleTimeZone getOffset() method in Java with Examples In SimpleTimeZone class, there are two types of getOffset() method depending upon the parameters passed to it. getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) The getOffset() method of SimpleTimeZone class is used to return the difference between local time and UTC, takin 3 min read TimeZone getID() Method in Java with Examples The getID() method of TimeZone class in Java is used to get official ID of a particular TimeZone. Syntax: public String getID() Parameters: The method does not take any parameters. Return Value: The method returns the ID of the TimeZone. Below programs illustrate the working of getID() Method of Tim 1 min read 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 e 1 min read OffsetTime getOffset() method in Java with examples The getOffset() method of OffsetTime class in Java gets the zone offset from the parsed time such as '+05:00' which can be considered as an example. Syntax : public ZoneOffset getOffset() Parameter : This method does not accepts any parameter. Return Value: It returns the zone offset and not null. B 1 min read TimeZone getDSTSavings() Method in Java with Examples The getDSTSavings() method of TimeZone class in Java is used to know the amount of time needed to be added to local standard time to get the wall clock time. Syntax: public int getDSTSavings() Parameters: The method does not take any parameters. Return Value: The method returns in milliseconds the a 1 min read TimeZone getDisplayName() Method in Java with Examples The getDisplayName() method of TimeZone class in Java is used to get a particular name of this TimeZone that is easily understood by the user. The name is appropriate for presentation and display purpose. Syntax: public final String getDisplayName() Parameters: The method does not take any parameter 1 min read OffsetDateTime getOffset() method in Java with examples The getOffset() method of OffsetDateTime class in Java gets the zone offset, such as '+05:00'. Syntax : public ZoneOffset getOffset() Parameter : This method accepts does not accepts any parameter. Return Value: It returns the zone offset, not null. Below programs illustrate the getOffset() method: 1 min read OffsetTime get() method in Java with examples The get() method of OffsetTime class in Java gets the value of the specified field from this time as an int. Syntax : public int get(TemporalField field) Parameter : This method accepts a parameter field which specifies the field to get, not null.Return Value: It returns the value for the field.Exce 2 min read OffsetTime getNano() method in Java with examples The getNano() method of OffsetTime class in Java is used to get the value of the nano-of-second field from this time instance. Syntax : public int getNano() Parameter: This method accepts does not accepts any parameters. Return Value: It returns the nano-of-second which ranges from 0 to 999, 999, 99 1 min read Like