• Post Reply Bookmark Topic Watch Topic
  • New Topic

How get Dates in a particular week Of year  RSS feed

 
RamandeepS Singh
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...!!

I want to get all the dates b/w particular week of the year
E.g say i want to get dates in the 34 week of 2008 year
and it will provide me the dates 17-08-2008 to 22-08-2009

Thanks in advance

Ramandeep S
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out java.util.Calendar.

In essence you do the following:
- get a Calendar object
- set the week of the year and optionally the year
- get the current day of the week
- subtract a number of days until you've reached the first day of the week (either Sunday or Monday, your choice)
- call getTime() to get your first date
- add 6 days
- call getTime to get your second date.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!