Java Utility Library

Java TimeZone - getDSTSavings() Method



The java.util.TimeZone.getDSTSavings() method returns the amount of time to be added to local standard time to get local wall clock time.

The default implementation returns 3600000 milliseconds (i.e., one hour) if a call to useDaylightTime() returns true. Otherwise, 0 (zero) is returned.

Syntax

public int getDSTSavings()

Parameters

No parameter is required.

Return Value

Returns the amount of saving time in milliseconds.

Exception

NA

Example:

The example below shows how to use java.util.TimeZone.getDSTSavings() method.

import java.util.*;

public class MyClass {
  public static void main(String[] args) {
    //creating a TimeZone object
    TimeZone tz = TimeZone.getTimeZone("CST");

    //printing DST saving
    System.out.println("DST saving is: " + tz.getDSTSavings());
  }
}

The output of the above code will be:

DST saving is: 3600000

❮ Java.util - TimeZone