Java TimeZone inDaylightTime() Example
TimeZone class inDaylightTime() method example. This example shows you how to use inDaylightTime() method.
Syntax is : public abstract boolean inDaylightTime(Date date)
This method check the given date is in daylight savings time in this time zone or not.
Here is the code.
/**
* @(#) InDaylightTimeTimeZone.java
* A class representing use of method inDaylightTime() of TimeZone
class in java.util Package.
* @Version 28-May-2008
* @author Rose India Team
*/
import java.util.*;
class InDaylightTimeTimeZone {
public static void main( String args[] ){
// Create object of TimeZone class.
TimeZone objTZ = TimeZone.getTimeZone("Europe/Paris");
// Create object of Date class.
Date objDate = new Date(2008 , 05, 28);
// inDaylightTime() method call.
boolean bool = objTZ.inDaylightTime(objDate);
System.out.println("Specified date is in daylight savings time in this"
+" time zone......." + bool);
}
} |
Output of the program.
| Specified date is in daylight savings time in this time zone.......true |
|