File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Calculating Dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calculating Dates" Watch "Calculating Dates" New topic
Author

Calculating Dates

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
What is the easiest way to add 10 weeks on to the Friday closest to today's date?
Does anyone have any good examples?
Any help is appreciated!
Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61774
    
  67

The java.util.Calendar class has everything you need. Specifically, check out the add() method.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
What about GregorianCalendar??
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
GregorianCalendar is what you need - Calendar is an abstract class, and GregorianCalendar is the standard implementation of it. It's a rather tedious, confusing API, but if you read it carefully you can accomplish what you want in just a few lines.


"I'm not back." - Bill Harding, Twister
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Thank You!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating Dates