java.util.TimeZone.inDaylightTime() Method


Advertisements


Description

The inDaylightTime(Date date) method is used to query if the given date is in daylight savings time in this time zone.

Declaration

Following is the declaration for java.util.TimeZone.inDaylightTime() method.

public abstract boolean inDaylightTime(Date date)

Parameters

date − This is the given Date

Return Value

The method call returns true if the given date is in daylight savings time, false, otherwise.

Exception

NA

Example

The following example shows the usage of java.util.TimeZone.inDaylightTime()

Live Demo
package com.tutorialspoint;

import java.util.*;

public class TimeZoneDemo {
   public static void main( String args[] ) {

      // create time zone object     
      TimeZone timezoneone = TimeZone.getDefault();

      // create date object
      Date date = new Date(2008 , 05, 28);

      // checking day light
      System.out.println("In daylight time:" +timezoneone.inDaylightTime(date));
   }    
}

Let us compile and run the above program, this will produce the following result.

In daylight time:false

java_util_timezone.htm

Advertisements