SimpleTimeZone setDSTSavings(int) in Java

setDSTSavings(int): This method is available in java.util.SimpleTimeZone class of Java.

Syntax:

void java.util.SimpleTimeZone.setDSTSavings(int millisSavedDuringDST)

This method takes one argument. This method sets the amount of time in milliseconds that the clock is advanced during daylight saving time.

Parameters: One parameter is required for this method.

millisSavedDuringDST: the number of milliseconds the time is advanced with respect to standard time when the daylight saving time rules are in effect.

Returns: NA

Exceptions: NA

Approach

Java

import java.util.SimpleTimeZone;

public class SimpleTimeZonesetDSTSavings {
    public static void main(String[] args) {

        SimpleTimeZone simpleTimeZone =
new SimpleTimeZone(100, "India");

        int millisSavedDuringDST = 1001;
        simpleTimeZone.setDSTSavings(millisSavedDuringDST);
        System.out.println(simpleTimeZone);
    }
}

Output:

java.util.SimpleTimeZone[id=India,offset=100,dstSavings=1001,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=0,endMonth=0,endDay=0,endDayOfWeek=0,endTime=0,endTimeMode=0]


No comments:

Post a Comment