Thomson:
Use DayOfWeek to determine how many days belong to the previous month. Then
add that number, whatever it is, to the current day and factor the sum by
seven to get the week of the calendar.
For example, here is how you would find the trailing days of November in
December's calendar:
DateTime d = new DateTime(2004,12,1);
int iTrailingDays = 0;
switch (d.DayOfWeek.ToString().Trim())
{
case "Monday":
iTrailingDays=1;
break;
case "Tuesday":
iTrailingDays=2;
break;
case "Wednesday":
iTrailingDays=3;
break;
...
}
Now to find out which week 12/5/2004 falls in, you would add 3 to 5, which
would put the fifth of December in the second week (because 8/7>1). Not
pretty, but it works.
Haile
[quoted text, click to view] "thomson" wrote:
> Hi all,
> How will i able to know which week does the day falls.Is
> there any method, which allows you to get
>
>
> For eg:
> Mon Tue Wed Thu Fri Sat Sun
> 1 2 3 4
> 5 6 7 8 9 10 11
>
>
> If i give 3 it should give 1st week, and if i
> give 8 it should give 2nd week
>
> Regards
>
> thomson