Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java dates

 
Jason Crest
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im confused on how to get the current date in the format of YYYY-MM-DD and then get 4 days previous to that in same format

how to do that?

thx
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Jason Crest
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
works so good! much thanks!
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Using the GregorianCalendar class, you don't need to go into the mathematical calculations.

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic