J
Jesse Houwing
Hmz...
I just found a little article on the Daily WTF and tried one of the
samples. And then I found that DateTimeFormat.MonthNames is actually 13
long... WHY?!
Is it to support different calendars? Is it to support 1 based indexes
in VB? I cannot wrap my head around it...
the article in question:
http://thedailywtf.com/Articles/Helpful-SQL-Helpers.aspx
The simplest solution I found:
public static string[] GetMonthNames(int startMonth)
{
var months = new
List<string>(DateTimeFormatInfo.CurrentInfo.MonthNames.Take(12));
return
months.Skip(startMonth).Concat(months.Take(startMonth)).ToArray();
}
I just found a little article on the Daily WTF and tried one of the
samples. And then I found that DateTimeFormat.MonthNames is actually 13
long... WHY?!
Is it to support different calendars? Is it to support 1 based indexes
in VB? I cannot wrap my head around it...
the article in question:
http://thedailywtf.com/Articles/Helpful-SQL-Helpers.aspx
The simplest solution I found:
public static string[] GetMonthNames(int startMonth)
{
var months = new
List<string>(DateTimeFormatInfo.CurrentInfo.MonthNames.Take(12));
return
months.Skip(startMonth).Concat(months.Take(startMonth)).ToArray();
}