java.util.SimpleTimeZone.setDSTSavings() Method


Advertisements


Description

The setDSTSavings(int millisSavedDuringDST) method is used to set the amount of time in milliseconds that the clock is advanced during daylight saving time.

Declaration

Following is the declaration for java.util.SimpleTimeZone.setDSTSavings() method.

public void setDSTSavings(int millisSavedDuringDST)

Parameters

  • millisSavedDuringDST -- This is the the number of milliseconds the time is advanced with respect to standard time.

Return Value

  • NA

Exception

  • NA

Example

The following example shows the usage of java.util.SimpleTimeZone.setDSTSavings()

package com.tutorialspoint;

import java.util.*;

public class SimpleTimeZoneDemo {
   public static void main( String args[] ){
   // create simple time zone object
   SimpleTimeZone stobj = new SimpleTimeZone(-28800000, "India", 
   Calendar.MAY, 1,-Calendar.SUNDAY, 7200000, Calendar.OCTOBER, -1,
   Calendar.MONDAY, 7200000, 3600000);
      
   // setting DST saving time
   stobj.setDSTSavings(5400000); 
      
   // checking the value      
   System.out.println("DST saving value : " + stobj.getDSTSavings());
   }     
}

Let us compile and run the above program, this will produce the following result.

DST saving value : 5400000

java_util_simpletimezone.htm

Advertisements