What is the First Day of the Week, Really?
If you are interested in a history lesson, try this lengthy explanation. Actually, it is quite fascinating.
If you are trying to make sure you app works worldwide, take a look below. Can you imagine if software like Microsoft Exchange did not take this into consideration? I think it would be pretty confusing as far as getting to work, meeting deadlines, scheduling tasks, etc.
Before I explain this, let’s start with some definitions in the .NET Framework
DateTimeFormatInfo.FirstDayOfWeek Property: Gets or sets the first day of the week.
Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Note: This property is affected if the value of the Calendar property changes.
Did you know that there is more than 1 definition to the First Day of the Week (in the .NET Framework)? Let’s see how many we can find.
In Visual Studio (VB code), I set the culture of the thread to a culture, say Spanish-Spain.
Thread.CurrentThread.CurrentCulture = New CultureInfo("es-ES", False)
Then, I’ll get some basic information to about the calendar used by that culture and its corresponding first day of the week.
ListBox1.Items.Add(CultureInfo.CurrentCulture.DisplayName)
ListBox1.Items.Add(CultureInfo.CurrentCulture.Calendar.ToString & ", " &
CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek.ToString)
Try this on several cultures as I did.
When I run this code, the results will show the Calendar name and the first day of the week, according to the calendar of the current culture.
Notice the different variations of the first day of the week I was able to get by adding a few cultures with my code.
Next time when you are in a business trip, you may want to consider using this code to make sure you make it in time (date).