Two Laptop Bag
The moose likes Beginning Java and the fly likes java dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java dates" Watch "java dates" New topic

java dates

Jason Crest

Joined: Oct 17, 2002
Posts: 29
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?

Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327

Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
Jason Crest

Joined: Oct 17, 2002
Posts: 29
works so good! much thanks!
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884

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

Hope this helps.

SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
I agree. Here's the link:
subject: java dates
It's not a secret anymore!