Java ZonedDateTime convert to GregorianCalendar

Description

Java ZonedDateTime convert to GregorianCalendar

import java.time.ZonedDateTime;
import java.util.GregorianCalendar;

public class Main {
  public static void main(String[] args) {
     ZonedDateTime zdt = ZonedDateTime.now();
     System.out.println("Zoned DateTime:  " + zdt);
     //  w ww. j av  a 2s . co  m

     GregorianCalendar gc2 = GregorianCalendar.from(zdt);
     System.out.println("Gregorian Calendar: " + gc2.getTime());

  }
}



PreviousNext

Related