TimeZone getDSTSavings() Method in Java with Examples
Last Updated :
02 Jan, 2019
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 amount of time needed to be added to local standard time to get the wall clock time. This is called the savings time.
Below programs illustrate the working of getDSTSavings() Method of TimeZone:
Example 1:
import java.util.*;
public class TimeZoneDemo {
public static void main(String args[])
{
TimeZone offtime_zone
= TimeZone
.getTimeZone( "Pacific/Pago_Pago" );
System.out.println( "The DST is: "
+ offtime_zone.getDSTSavings());
}
}
|
Example 2:
import java.util.*;
public class TimeZoneDemo {
public static void main(String args[])
{
TimeZone offtime_zone
= TimeZone.getTimeZone( "Europe/Rome" );
System.out.println( "The DST is: "
+ offtime_zone.getDSTSavings());
}
}
|
Output:
The DST is: 3600000
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html#getDSTSavings()
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...