TimeZone observesDaylightTime() in Java

observesDaylightTime(): This method is available in java.util.TiimeZone class of Java.

Syntax:

boolean java.util.TimeZone.observesDaylightTime()

This method returns true if this TimeZone is currently inDaylight Saving Time, or if a transition from Standard Time toDaylight Saving Time occurs at any future time.

Parameters: NA

Returns: true if this TimeZone is currently in Daylight Saving Time, or if a transition from Standard Time to Daylight Saving Time occurs at any future time; false otherwise.

Exceptions: NA

Approach

Java

import java.util.SimpleTimeZone;
import java.util.TimeZone;

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

        TimeZone timeZone = new SimpleTimeZone(100, "US");

        System.out.println(timeZone.observesDaylightTime());
    }
}

Output:

false


No comments:

Post a Comment