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








Syntax

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

public boolean hasSameRules(TimeZone other)

Example

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

/*from www  . java  2  s  .  c  om*/

import java.util.SimpleTimeZone;

public class Main {
   public static void main( String args[] ){
      // create two simple time zone object 
      SimpleTimeZone stobj1 = new SimpleTimeZone(820,"US");
      SimpleTimeZone stobj2 = new SimpleTimeZone(820,"GMT");
      
      // check rules for both objects
      boolean samerule=stobj1.hasSameRules(stobj2); 
      
      // checking the value       
      System.out.println("Hash same rule : " + samerule);
   }    
}

The code above generates the following result.