The getDSTSavings() method of SimpleTimeZone class returns the amount of time (in milliseconds) that the clock advances during daylight saving time.
Syntax:
public int getDSTSavings()
Parameters: The function does not accepts any parameter.
Return Value: The method returns the time is advanced with respect to standard time(in milliseconds).
Exception: The function does not throws any exception.
Program below demonstrates the above mentioned function:
Program 1:
// program to demonstrate the // function java.util.date.getDSTSavings() import java.util.SimpleTimeZone; public class GFG { public static void main(String[] args) { // creating simple time zone object SimpleTimeZone obj = new SimpleTimeZone( 580 , "India" ); // check DST saving and print System.out.println( "DST saving = " + obj.getDSTSavings()); } } |
DST saving = 0
Program 2:
// program to demonstrate the // function java.util.date.getDSTSavings() import java.util.SimpleTimeZone; public class GFG { public static void main(String[] args) { // creating simple time zone object SimpleTimeZone obj = new SimpleTimeZone( 580 , "US" ); // check DST saving and print System.out.println( "DST saving = " + obj.getDSTSavings()); } } |
DST saving = 0