Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes getting system date 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 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getting system date" Watch "getting system date" New topic

getting system date

akhter wahab
Ranch Hand

Joined: Mar 02, 2009
Posts: 151

hey guys i wrote a program that can get the system date but problem is i want to add 7 days in the current date how could it be possible not getting please help
here is the code

Start Earning Online||Start Earning Using Java
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
Did you check if the Calendar class had any methods that might help ?

Fredrik Sassenberg

Joined: Jul 08, 2009
Posts: 4

The calender class can be a bit tricky to work with. But it does have a method add which I think will solve your problem.

So I added the line to your program:

Rob Spoor

Joined: Oct 27, 2005
Posts: 19844

Fredrik, there is a reason Joanne didn't mention that method. Please don't provide full answers if a hint will be enough.

How To Ask Questions How To Answer Questions
Fredrik Sassenberg

Joined: Jul 08, 2009
Posts: 4
After reading up a bit on the link you provided I see your point Rob.
My good intention wasn't well thought through. Thank you for the information.

Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

two method are there .
First is add and second is roll.but you can use only one i .e add

SCJP6.0,My blog Ranchers from Delhi
I agree. Here's the link:
subject: getting system date