Close

Java Date Time - ZoneId.normalized() Examples

Java Date Time Java Java API 


Class:

java.time.ZoneId

java.lang.Objectjava.lang.Objectjava.time.ZoneIdjava.time.ZoneIdjava.io.SerializableSerializableLogicBig

Method:

public ZoneId normalized()

Normalizes the time-zone ID, returning a ZoneOffset where possible. The normalization checks if the rules of this ZoneId have a fixed offset. If they do, then the ZoneOffset equal to that offset is returned. Otherwise this is returned.


Examples


package com.logicbig.example.zoneid;

import java.time.ZoneId;

public class NormalizedExample {

public static void main(String... args) {
ZoneId z = ZoneId.of("UTC-05:00");
System.out.println(z);

ZoneId z2 = z.normalized();
System.out.println(z2);

}
}

Output

UTC-05:00
-05:00




See Also