Java Date Time - Java TimeZone .hasSameRules ( TimeZone other)








Syntax

TimeZone.hasSameRules(TimeZone other) has the following syntax.

public boolean hasSameRules(TimeZone other)

Example

In the following code shows how to use TimeZone.hasSameRules(TimeZone other) method.

//from  w  ww .  ja v  a  2s .co m


import java.util.TimeZone;

public class Main {
   public static void main( String args[] ){
        
      TimeZone timezoneone = TimeZone.getDefault();
      TimeZone timezonetwo = TimeZone.getDefault(); 
      
      // comparing two time zones
      boolean res=timezoneone.hasSameRules(timezonetwo);
      
      // checking the result   
      System.out.println("Comparison result:" +res );
   }    
}

The code above generates the following result.