All the other mutators got deprecated back in JDK 1.1, so why was setTime()
left as is? Surely java.util.Calendar
- the correct way to manipulate dates - can create new instances of java.util.Date
as needed using the java.util.Date(long)
constructor?
The bits of Date
that were deprecated were those bits that related to calendars (i.e. day, month, year, etc). You'll note that the accessor methods for calendar fields are also deprecated, not just the mutators.
The representation as a milliseconds value, however, is still the way Date
works, and is unrelated to the calendar representation, so it stayed as undeprecated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With