Java TimeZone hasSameRules() MethodThe hasSameRules(TimeZone other) is a method of TimeZone class. If the zone has the same rule and offset as another zone, it returns true. If one of the zone is null, it will return false. Syntax:Parameters:other - It is the object of TimeZone to be compared. Returns:It returns true if zone and offset have the same rule as the another zone Example 1Output: Comparison result: true Example 2Output: Comparison result:false TimeZone of Indian/Mahe :sun.util.calendar.ZoneInfo[id="Indian/Mahe",offset=14400000,dstSavings=0,useDaylight=false, transitions=3,lastRule=null] TimeZone of Israel:sun.util.calendar.ZoneInfo[id="Indian/Mahe",offset=14400000,dstSavings=0,useDaylight=false, transitions=3,lastRule=null] Example 3Output: Comparison result: true TimeZone1 of Indian/Mahe :sun.util.calendar.ZoneInfo[id="Indian/Mahe",offset=14400000,dstSavings=0,useDaylight=false, transitions=3,lastRule=null] TimeZone2 of Indian/Mahe:sun.util.calendar.ZoneInfo[id="Indian/Mahe",offset=14400000,dstSavings=0,useDaylight=false, transitions=3,lastRule=null] Next TopicJava-timezone-indaylighttime-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India