Last post Oct 05, 2006 05:25 AM by sreejukg
Jul 28, 2006 10:30 PM|FatMike206|LINK
Hi, I need help to to a very simple task:
Given an integer, I want a way to get the correspondent month name in a culture-specific way.
eg.: give the number 2, i want "February".
Of course, I could declare an static array of string, and populate it with the months names, but it just wouldn't be ellegant!!
Any help would be apprecidated!!
Jul 29, 2006 12:35 AM|DarrellNorton|LINK
There's no built-in enum for month in the .NET Framework that I know of. However, there seems to be one in the SQL Server namespace:
I'm not sure how you would use it.
Oct 05, 2006 04:30 AM|dotnetslave.com|LINK
The easiest to do this is like this:
will show you the current month name.
lblCurrMonth.Text =MonthName(2) will give you February.
Hope it helps,
Oct 05, 2006 05:25 AM|sreejukg|LINK
If you are using c# , the above code will not work, since MonthName is defined in the Namespace "Microsoft.VisualBasic"
so if you are using c# use
lblCurrMonth.Text = Microsoft.VisualBasic.DateAndTime.MonthName(2);