Java ZonedDateTime get ZoneOffset and ZoneId
import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; public class Main { public static void main(String[] args) { // Get the current zoned date time for the system default time zone ZonedDateTime zdt1 = ZonedDateTime.now(); System.out.println("Current zoned datetime:" + zdt1); // Get zone offset and zone id ZoneOffset offset = zdt1.getOffset(); ZoneId zone = zdt1.getZone(); System.out.println("Offset:" + offset + ", Zone:" + zone); }/* www .j ava2s. co m*/ }