hasSameRules(TimeZone): This method is available in java.util.SimpleTimeZone class of Java.
Syntax:
boolean java.util.SimpleTimeZone.hasSameRules(TimeZone other)
This method takes one argument. This method returns true if this zone has the same rules and offset as another zone.
Parameters: One parameter is required for this method.
other: the TimeZone object to be compared with.
Returns: true if the given zone is a SimpleTimeZone and has the same rules and offset as this one.
Exceptions: NA
Approach
Java
import java.util.SimpleTimeZone;public class SimpleTimeZonehasSameRules {public static void main(String[] args) {SimpleTimeZone simpleTimeZone =new SimpleTimeZone(100, "India");System.out.println(simpleTimeZone.hasSameRules(simpleTimeZone));}}
Output:
true
No comments:
Post a Comment