Getting current time in Java 8
I am exploring the new java.time API of Java 8. I am particularly trying to retrieve the current time (my current time zone, of a different time zone, and of a different offset). The code is: public static void getCurrentLocalTime(){ LocalTime time = LocalTime.now(); System.out.println("Local Time Zone: "+ZoneId.systemDefault().toString()); System.out.println("Current local time : " + time); } public static void getCurrentTimeWithTimeZone(){ LocalDateTime localtDateAndTime = LocalDateTime.now(); ZoneId zoneId = ZoneId.of("America/Los_Angeles"); ZonedDateTime dateAndTimeInLA = ZonedDateTime.of