Showing posts from October, 2014

New Date &Time API from JDK 8

New Date & Time API from JDK 8 Date and Time handling in Java was tricky and not thread safe. Current system time can be accessed via  he static method  System.currentTimeMillis()   which returns the current time in milliseconds. Even though java.util.Date is there, it does not provide lot of date and time related functions that are convenient to the developer.In other words Date and Calendar API are not much developer friendly as other API for a long time,  most developers tend to Joda Date Time  library due to these reasons. This latest JDK 8 release Java team revolutionize the Date and Time api and introduced full featured thread safe, developer friendly API. It drag my attention to try out new API features. Following will explain the new features with some sample code snippets. New Structure of the Date Time API java.time  : This is the base package of new Java Date Time API. All the major base classes are part of this package, such as LocalDate, LocalTime, Lo