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
32688 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7057 POSTS0 COMMENTS
Nicole Veronica
12198 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12293 POSTS0 COMMENTS
Shaida Kate Naidoo
7182 POSTS0 COMMENTS
Ted Musemwa
7447 POSTS0 COMMENTS
Thapelo Manthata
7160 POSTS0 COMMENTS
Umr Jansen
7150 POSTS0 COMMENTS