views:

98

answers:

3

Is there a way to find the days that constitute a weekend or workweek based on different cultures using the .NET framework? For example, some Muslim countries have a workweek from Sunday through Thursday.

A: 

I won't give you a .NET answer, but I will say that you won't base it on "culture", but rather on country.

You can get country from IP with a fir degree of accuracy (but it will never be 100%). After that, I would suggest a lot of googling, because I doubt that you are going to find the code already written.

(you might also look into some open source calendar/appointment programs, especially widely-used ones, like on Linux, or maybe Lightning, the Thunderbird plug-in. If you wade through their code, you might find the data for this)

Fortunately, though, you just face a grind, rather than something difficult to implement.

Good luck!

Mawg
+1  A: 

The only thing i know is how to get the day the week starts. Perhaps this can help:

CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek

from System.Globalization, perhaps you find in this package something.

There are several Calendar-Classses like JulianCalendar, HebrewCalendar and so on. It could be possible to find there what you want.

martin
A: 

Hi there, found the question interesting - did not have an answer myself.. but located an interesting resource - also discussing calendars.

Calendar converter

Anders