Returns the unique time-zone ID of this ZoneId object.
package com.logicbig.example.zoneid;
import java.time.ZoneId;
import java.time.ZonedDateTime;
public class GetIdExample {
public static void main(String... args) {
ZoneId z = ZonedDateTime.now().getZone();
System.out.println(z);
String id = z.getId();
System.out.println(id);
}
}
Output
America/Chicago
America/Chicago