by Michael S. Kaplan, published on 2006/08/24 03:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/08/24/710624.aspx
My customer is programming with .NET.
Now he wanted to know if there is a way to determine if a given day in a Calendar is a weekend based on certain culture.
It is “Friday/Saturday” in the Middle East, “Saturday/Sunday” in Europe/Americas and probably something else in somewhere else.
We are trying to find a method similar as IsWeekend(Date d).
Based on my research, this code below will get the first day of week based on the culture.
CultureInfo myCI = new CultureInfo("en-US");
Is there a similar method for the information about weekend?
Hmmm. Not exactly the same question as the one asked in How many days in a weekend?, but close. And I did hypothesize back in that post from almost a year ago that the weekend was always in LOCALE_SDAYNAME6 and LOCALE_SDAYNAME7. But several people have pointed out that it ain't always so (there are indeed places that consider Sunday to be the first day of the week but Saturday/Sunday to the weekend.
So there really is no way in Windows or the .NET Framework to find out when the weekend is, per locale/culture.
What do you expect from a company with developers who think that working a half day means putting in 12 hours? :-)
This post brought to you by ⓦ (U+24e6, a.k.a. CIRCLED LATIN SMALL LETTER W)
# Eric Duran on 25 Aug 2006 6:12 PM:
go to newer or older post, or back to index or month or day