Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When to use Date and when to use calendar?

 
jacob deiter
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When to use Date and when to use calendar?

Since both are used for data manipulations only?
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't use Date for date manipulation. Most of the methods there have already been deprecated.
 
James Dixon
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the methods there have already been deprecated.


why it is depreciated?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Beause there is better support for date manipulation in the Calendar class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic