wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java dates" Watch "java dates" New topic
Author

java dates

Jason Crest
Greenhorn

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?

thx
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
Greenhorn

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java dates
 
Similar Threads
Current time
encoding and decoding in java
pdf generation
Time stamp format
IReports