SimpleTimeZone setStartYear(int) in Java

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

Syntax:

void java.util.SimpleTimeZone.setStartYear(int year)

This method takes one argument. This method sets the daylight saving time starting year.

Parameters: One parameter is required for this method.

year: The daylight saving starting year.

Returns: NA

Exceptions: NA

Approach

Java

import java.util.SimpleTimeZone;

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

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

        int year = 2000;

        simpleTimeZone.setStartYear(year);

        System.out.println(simpleTimeZone);
    }
}

Output:

java.util.SimpleTimeZone[id=India,offset=100,dstSavings=3600000,useDaylight=false,startYear=2000,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