Java GregorianCalendar create from ZonedDateTime

Description

Java GregorianCalendar create from ZonedDateTime

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  .  ja  va2 s  .  c  o m

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

  }
}



PreviousNext

Related