Java TimeZone convert to ZoneId

Description

Java TimeZone convert to ZoneId

import java.time.ZoneId;
import java.util.TimeZone;

public class Main {
  public static void main(String[] args) {
     TimeZone tz = TimeZone.getDefault();
     System.out.println("tz:"+tz);
     //w  w  w . j  av a  2s .  co m
     ZoneId zoneId = tz.toZoneId();
     System.out.println("zoneId:"+zoneId);
  }
}



PreviousNext

Related