Click here to Skip to main content
15,917,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I need to find the week of the day and the subsequent date's from my date range.

Example :
From date - 08-Nov-2010
To date - 25-Nov-2010

I need the output as

2 - because 08-Nov-2010 pretains to 2nd week of november
08-Nov-2010 15-Nov-2010 22-Nov-2010 - because these are the days (monday) which lie inbetween the date range.

Please help me.

Thanks,
Karan
Posted
Comments
Ankur\m/ 18-Nov-10 7:51am    
I have deleted your answer. Do not click 'Add Answer' if you are not answering the question. There's a 'Add Comment' link below a user's answer. use that for discussing with an answerer for that notifies him but an answer doesn't.

1 solution

Well, a week is seven days long, so if the date is 15 Nov, you're in the 3rd week because 15 is greater than 14.

It ain't rocket science.
 
Share this answer
 
Comments
Ankur\m/ 18-Nov-10 7:48am    
[moved from answer]:
OP wrote:

Thanks for your reply.
but compare 24-Apr-2010 and 24-May-2010, this will lie in different weeks.
please help.
Regards,
Karan
Ankur\m/ 18-Nov-10 7:58am    
No, both of them are dates from 4th week. Where is the problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900