SimpleTimeZone inDaylightTime(Date) in Java

inDaylightTime(Date): This method is available in java.util.SimpleTimeZone class of Java.

Syntax:

boolean java.util.SimpleTimeZone.inDaylightTime(Date date)

This method takes one argument. This method queries if the given date is in daylight saving time.

Parameters: One parameter is required for this method,

date: the given Date.

Returns: true if daylight saving time is ineffective at the given date; false otherwise.

Exceptions: NA

Approach

Java

import java.util.Date;
import java.util.SimpleTimeZone;

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

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

        Date date = new Date();
        System.out.println(simpleTimeZone.inDaylightTime(date));
    }
}

Output:

false


No comments:

Post a Comment