Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get future dates??

Status
Not open for further replies.

bunnyweb

MIS
Jan 13, 2003
42
IE
I am trying to find a way to get future dates and I'm stuck.



I am taking in a String which contains a set date

String myDate = "30/05/2003" (UK format)

How would I go about adding 3 weeks to this date to get:

myNewDate = "20/06/2003"



I also need to do the same for months. Again, I'm taking in the the date:

String myDate = "14/10/2003"

How would I add 3 months to this date to get:

myNewDate = "14/01/2004"



Please, any help would be *greatly* appreciated.

Rachel
 
Take a look at java.util.GregorianCalendar and specifically its add() function.
 
I tried working with the Calendar class, but got absolutely nowhere. I'm sure I'm on the right track, but I could really use an example if you have it.

Thanks!!

Rachel
 
Take a look at this thread thread269-547729...let me know if you need some more examples..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top