Monday, June 15, 2026
HomeLanguagesJavaSimpleTimeZone getDSTSavings() method in Java with Examples

SimpleTimeZone getDSTSavings() method in Java with Examples

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());
    }
}


Output:

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());
    }
}


Output:

DST saving = 0
RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS