java.util.SimpleTimeZone.inDaylightTime() Method
Advertisements
Description
The inDaylightTime(Date date) method is used to query if the given date is in daylight saving time.
Declaration
Following is the declaration for java.util.SimpleTimeZone.inDaylightTime() method.
public boolean inDaylightTime(Date date)
Parameters
date--This is the given Date.
Return Value
The method call returns 'true' if daylight saving time is in effective at the given date; false otherwise.
Exception
NA
Example
The following example shows the usage of java.util.SimpleTimeZone.inDaylightTime()
package com.tutorialspoint;
import java.util.*;
public class SimpleTimeZoneDemo {
public static void main( String args[] ){
// create simple time zone object
SimpleTimeZone stobj1 = new SimpleTimeZone(820,"GMT");
// create date
Date date = new Date(2012, 04, 23);
// check day light
boolean daylight=stobj1.inDaylightTime(date);
// checking the value of day light
System.out.println("Is in day light : " + daylight);
}
}
Let us compile and run the above program, this will produce the following result.
Is in day light : false