Reputation: 1351
I'm new to this Java thing and I'm a little unclear on how I would write my own DateFormat subclass if Date is (mostly?) deprecated.
Upvotes: 1
Views: 118
Reputation: 2036
Date
represents a specific millisecond in time. In other words, Date
is a wrapper around a long millisecond value. Calendar
is used for getting the specific day of the week, month, etc. of a Date
.
Use DateFormat
. You can use the getDate
method of a Calendar
to pass a Date
object to DateFormat
.
Also, you may find Joda time useful.
Upvotes: 1
Reputation: 46408
Firstly java.text.DateFormat class
is not deprecated, you use java.util.Date
class as a bridge to format a java.util.Calendar
object using java.text.DateFormat
class.
java.text.DateFormat---> use this class to format dates.
java.util.Calendar ---> use this class to perform date related operations.
Upvotes: 1