Java tutorial
import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.OffsetDateTime; import java.time.OffsetTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { public static void main(String[] args) { GregorianCalendar gc = new GregorianCalendar(2014, 1, 11, 15, 45, 50); LocalDate ld = gc.toZonedDateTime().toLocalDate(); System.out.println("Local Date: " + ld); LocalTime lt = gc.toZonedDateTime().toLocalTime(); System.out.println("Local Time: " + lt); LocalDateTime ldt = gc.toZonedDateTime().toLocalDateTime(); System.out.println("Local DateTime: " + ldt); OffsetDateTime od = gc.toZonedDateTime().toOffsetDateTime(); System.out.println("Offset Date: " + od); OffsetTime ot = gc.toZonedDateTime().toOffsetDateTime().toOffsetTime(); System.out.println("Offset Time: " + ot); ZonedDateTime zdt = gc.toZonedDateTime(); System.out.println("Zoned DateTime: " + zdt); ZoneId zoneId = zdt.getZone(); TimeZone timeZone = TimeZone.getTimeZone(zoneId); System.out.println("Zone ID: " + zoneId); System.out.println("Time Zone ID: " + timeZone.getID()); GregorianCalendar gc2 = GregorianCalendar.from(zdt); System.out.println("Gregorian Calendar: " + gc2.getTime()); } }