Home » Core Java » Java 8 Date Time API

Java 8 Date Time API

Java 8 Date Time API is one of the best features in Java8.

Why Java 8 Date Time API needed ?
1. Prior to Java8 we have SimpleDateFormatter and java.util.Date and both are not Thread safe.Every application now a days requires concurrency and multithreading support.So slowly application developers started preferring 3rd party library JodaTime over java.util.Date package.This was a concern for Java Team and they come up with Java Date Time API which is thread safe.
2. Prior to Java 8 some of the date and time classes has poor API design in terms of date range.For example,default years in java.util.Date start at 1900,default months start at 1, and default days start at 0, so not very good.
3. Also Developers need to code a lot to handle TimeZone due to poor API design.

Program :::


Output ::

Leave a comment

Your email address will not be published. Required fields are marked *

15 − 15 =