The inDaylightTime(Date) method of TimeZone class in Java is used to check and verify whether the given date is in daylight saving time.
public abstract boolean inDaylightTime(Date date)
Parameters: The method takes one parameter date of Date type which is the given date to be verified.
Return Value: The method returns boolean True if the passed date is ineffective with respect to the daylight saving time else the method return boolean False.
Below programs illustrate the use of inDaylightTime() Method in Java:
Is it in day light saving time? true
Is it in day light saving time? false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.