SimpleTimeZone setRawOffset(int) in Java

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

Syntax:

void java.util.SimpleTimeZone.setRawOffset(int offsetMillis)

This method takes one argument. This method sets the base time zone offset to GMT.

Parameters: One parameter is required for this method.

offsetMillis: the given base time zone offset to GMT.

Returns: NA

Exceptions: NA

Approach

Java

import java.util.SimpleTimeZone;

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

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

        int offsetMillis = 10100;
        simpleTimeZone.setRawOffset(offsetMillis);
        System.out.println(simpleTimeZone);
    }
}

Output:

java.util.SimpleTimeZone[id=India,offset=10100,dstSavings=3600000,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