Working with Dates and Times
IN THIS CHAPTER
Understanding human and computer dates and times
Using java.time classes to represent dates and times
Comparing dates and times
Performing calculations with dates and times
Formatting dates and times
Does anybody really know what time it is? Does anybody really care about time?
So mused Robert Lamm of The Chicago Transit Authority (later known as simply Chicago) in 1969.
I’m not sure who cared much about time in 1969, but I do know that the people who designed the original version of Java in 1995 didn’t care much about it, at least as evidenced by the weak classes they provided for working with times and dates in the
Java.util package. Java programmers have long struggled with simple calculations involving dates and times, such as determining what the date will be 45 days from today or calculating the number of days between two given dates.
Java finally got with the times with the release of Java 8, which introduced an entirely ...