Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calculating Dates

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java.util.Calendar class has everything you need. Specifically, check out the add() method.
hth,
bear
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about GregorianCalendar??
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic