The useDaylightTime() method of TimeZone class is used perform a query on this time zone to know whether it uses the daylight saving time.
public abstract boolean useDaylightTime()
Parameters: The method does not accept any parameters.
Return Value: The method returns either of the two boolean values:
- ‘true’ if this time zone uses daylight saving time
- ‘false’ if this time zone does not use daylight saving time
Below program demonstrates the above-mentioned function:
Day light time is = true
Day light time is = 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.