Get timezone id
String getID()
- Gets the ID of this time zone.
import java.util.TimeZone;
public class Main {
public static void main(String[] args) {
TimeZone tz = TimeZone.getTimeZone("America/New_York");
System.out.println(tz.getID());
}
}
The output:
America/New_York