inDaylightTime(Date): This method is available in java.util.TimeZone class of Java.
Syntax:
boolean java.util.TimeZone.inDaylightTime(Date date)
This method takes one argument. This method queries if the given date is in Daylight Saving Time in this time zone.
Parameters: One parameter is required for this method.
date: the given Date.
Returns: true if the given date is in Daylight Saving Time, false, otherwise.
Exceptions: NA
Approach
Java
import java.util.Date;import java.util.SimpleTimeZone;import java.util.TimeZone;public class TimeZoneinDaylightTime {public static void main(String[] args) {TimeZone timeZone = new SimpleTimeZone(100, "US");Date date = new Date();System.out.println(timeZone.inDaylightTime(date));}}
Output:
false
No comments:
Post a Comment