Java TimeZone useDaylightTime() Example

TimeZone class useDaylightTime() method example. This example shows you how to use useDaylightTime() method.


Syntax is : public abstract boolean useDaylightTime()
This method queries that this time zone uses daylight savings time or not and returns boolean true or false.

Here is the code.
/**
 * @(#) UseDaylightTimeTimeZone.java
 * A class representing use of method useDaylightTime() of TimeZone
 class in java.util Package.
 * @Version  28-May-2008
 @author   Rose India Team
 */
import java.util.*;

class UseDaylightTimeTimeZone {
    public static void mainString args[] ){

        // Create object of TimeZone class. 
        TimeZone objTZ1 = TimeZone.getDefault();
        TimeZone objTZ2 = TimeZone.getTimeZone("America/Los_Angeles");
        // useDaylightTime() method call for dafault time zone.
      boolean bool = objTZ1.useDaylightTime();
      System.out.println("objTZ1 time zone uses daylight savings time.."+bool);

       bool = objTZ2.useDaylightTime();
      System.out.println("objTZ2 time zone uses daylight savings time.."+bool);
  }
}

Output of the program.
objTZ1 time zone uses daylight savings time..false
objTZ2 time zone uses daylight savings time..true

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US