About
Java.time package supplants the old java.util.Date/Calendar classes.
- java.time since JDK1.8. It contains the main API based on the ISO-8601 standard. See Date and Time Api Specification in Java 8
Let op: javase/9/docs/api/java/util/concurrent/TimeUnit.html. A TimeUnit does not maintain time information (just for thread concurrency)
TimeUnit.SECONDS.sleep(100);Object
- javase/9/docs/api/java/time/LocalDateTime.html - A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.
Example
- Build an instant
Instant.parse("2016-05-02T14:53:27Z")
- Diff between two date time in millisecond
ChronoUnit.MILLIS.between(startTime, endTime);