- The Java
java.util.Date
andjava.util.Calendar
Classes are not easy to use, do not support time zones, and they are not thread-safe; - A class for formatting dates
DateFormat
Is placed onjava.text
Package, it is an abstract class, so we need to instantiate oneSimpleDateFormat
Object to handle date formatting, andDateFormat
It’s also not thread-safe, which means if you’re calling the same thing in a multithreaded programDateFormat
Object, will get unexpected results. - The calculation of dates is tedious and error prone, because the months start at zero, from
Calendar
You need to add one to indicate the current month.