This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes When to use Date and when to use calendar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "When to use Date and when to use calendar?" Watch "When to use Date and when to use calendar?" New topic
Author

When to use Date and when to use calendar?

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
When to use Date and when to use calendar?

Since both are used for data manipulations only?
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

You shouldn't use Date for date manipulation. Most of the methods there have already been deprecated.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
James Dixon
Ranch Hand

Joined: Jun 20, 2009
Posts: 32
Hi Jacob

If you look at the java docs it gives you quite a good explanation about the differences between the two:
Date
Calendar

Personally I wouldn't use either. Joda Time is a lot more developer friendly for any time/date manipulation you want to do.
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
Most of the methods there have already been deprecated.


why it is depreciated?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Beause there is better support for date manipulation in the Calendar class.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: When to use Date and when to use calendar?
 
Similar Threads
how do I find date difference in months
rendering calendar object
Date,Calendar class
string to java.util.Date and then to java.sql.Date
timezone woes