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.


/* w  ww  .j av  a2s .  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.