A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/java/util/simpletimezone_hashsamerules.htm below:

Java SimpleTimeZone hasSameRules( TimeZone other) Method

Java SimpleTimeZone hasSameRules( TimeZone other) Method Description

The Java SimpleTimeZone hasSameRules(TimeZone other) method is used to 'true' if this zone has the same rules and offset as another zone.

Declaration

Following is the declaration for java.util.SimpleTimeZone.hasSameRules() method.

public boolean hasSameRules(TimeZone other)
Parameters

other − This is the TimeZone object to be compared with

Return Value

The method call returns 'true' if the given zone is a SimpleTimeZone and has the same rules and offset as this one.

Exception

NA

Checking SimpleTimeZone of US and GMT TimeZone if are Having Same Rules Examples

The following example shows the usage of Java SimpleTimeZone hasSameRules() method to check if two SimpleTimeZone objects have same rules. We've created a SimpleTimeZone using US and GMT. Then we've checked the rules using hasSameRules() method and printed the status.

package com.tutorialspoint;

import java.util.SimpleTimeZone;

public class SimpleTimeZoneDemo {
   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);
   }    
}
Output

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

Hash same rule : true
Checking SimpleTimeZone of US and UK TimeZone if are Having Same Rules Examples

The following example shows the usage of Java SimpleTimeZone hasSameRules() method to check if two SimpleTimeZone objects have same rules. We've created a SimpleTimeZone using US and UK. Then we've checked the rules using hasSameRules() method and printed the status.

package com.tutorialspoint;

import java.util.SimpleTimeZone;

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

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

Hash same rule : true
Checking SimpleTimeZone of US and India TimeZone if are Having Same Rules Examples

The following example shows the usage of Java SimpleTimeZone hasSameRules() method to check if two SimpleTimeZone objects have same rules. We've created a SimpleTimeZone using US and India. Then we've checked the rules using hasSameRules() method and printed the status.

package com.tutorialspoint;

import java.util.SimpleTimeZone;

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

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

Hash same rule : true

java_util_simpletimezone.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4