We would like to know how to convert GregorianCalendar to ZonedDateTime.
import java.time.ZonedDateTime; import java.util.GregorianCalendar; //ww w. ja va2 s.c o m public class Main { public static void main(String[] args) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); ZonedDateTime d = gregorianCalendar.toZonedDateTime(); System.out.println(d); } }
The code above generates the following result.