Dont know if its the best way, but I solved it like this,
public static DateTime thisSunday(DateTime targetDate)
{
int realDay = 1;
if (targetDate.DayOfWeek == 0) realDay = 7; else realDay =
(int)targetDate.DayOfWeek;
return targetDate.AddDays(7 - realDay);
}
"Just Me" <news.microsoft.com> wrote in message
news:%(E-Mail Removed)...
> .NET enumerates the day of the week as 0-6 ( Sunday to Saturday ). This
> seems to remain the same regardless of the culture settings.
>
> Just wondering if this is alterable is some way, and if not how you guys
> work out for example, next Sunday. I mean sure, I can create a function
> which will allways return the number of days between today and sunday
> using for example the day name and a select statement, but it seems too
> complex.
>
> Any ideas on the simple approach ?
>
|