The most poorly understood and incorrectly used APIs in Java that I have seen in my years as a consultant at multiple companies is the Java Date-Time APIs. Even though the APIs were introduced 10 years ago in Java 8, I still see programmers using the older Date class, I've seen horrific misuse of the Java 8 Date Time APIs, and I have had to correct issues with both production code and test code due to fundamental understandings of the APIs. This presentation gives a crash course into the proper use of the Java Date-Time APIs, why they are needed, and how (and when) to properly apply them.
Attendees will learn the basics of how to properly specify a date and time in Java. They will learn when to use local date/times and when to use zoned date/times. They will be introduced to ISO 8601 and see how to properly parse and format dates in a thread safe manner. The use of ZoneIds and OffsetDateTimes will be explained. Attendees will learn to use the Period and Duration classes to calculate the difference between two dates or times. Finally, some pointers will be given on properly using dates and times in unit tests.
The goal for this presentation is for attendees to be able to confidently and correctly use dates and times in Java instead of blindly copying and pasting code from the Internet.