ZoneId of(String zoneId) example

Description

ZoneId of(String zoneId) creates an instance of ZoneId from an ID.

Syntax

of has the following syntax.


public static ZoneId of(String zoneId)

Example

The following example shows how to use of.


import java.time.ZoneId;
/* ww w .  ja  v  a 2s  . com*/
public class Main {
  public static void main(String[] args) {
    ZoneId z = ZoneId.of("UTC");
    
    System.out.println(z);
  } 
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset