java.time – ZoneId


java.time.ZoneId Class


”;


Introduction

The java.time.ZoneId class represents a time-zone ID, such as Europe/Paris.

Class declaration

Following is the declaration for java.time.ZoneId class −

public abstract class ZoneId
   extends Object
      implements Serializable

Field

Following are the fields for Java.time.ZoneId class −

  • static Map<String,String> SHORT_IDS − A map of zone overrides to enable the short time-zone names to be used.

Class methods

Sr.No. Method & Description
1 boolean equals(Object obj)

Checks if this time-zone ID is equal to another time-zone ID.

2 static ZoneId from(TemporalAccessor temporal)

Obtains an instance of ZoneId from a temporal object.

3 static Set<String> getAvailableZoneIds()

Gets the set of available zone IDs.

4 String getDisplayName(TextStyle style, Locale locale)

Gets the textual representation of the zone, such as ”British Time” or ”+02:00”.

5 abstract String getId()

Gets the unique time-zone ID.

6 abstract ZoneRules getRules()

Gets the time-zone rules for this ID allowing calculations to be performed.

7 int hashCode()

A hash code for this time-zone ID.

8 ZoneId normalized()

Normalizes the time-zone ID, returning a ZoneOffset where possible.

9 static ZoneId of(String zoneId)

Obtains an instance of ZoneId from an ID ensuring that the ID is valid and available for use.

10 static ZoneId of(String zoneId, Map<String,String> aliasMap)

Obtains an instance of ZoneId using its ID using a map of aliases to supplement the standard zone IDs.

11 static ZoneId ofOffset(String prefix, ZoneOffset offset)

Obtains an instance of ZoneId wrapping an offset.

12 static ZoneId systemDefault()

Gets the system default time-zone.

13 String toString()

Outputs this zone as a String, using the ID.

Methods inherited

This class inherits methods from the following classes −

  • Java.lang.Object

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *