That's way more work than is necessary:
int wday = 0;
DayOfWeek day = (DayOfWeek) wday;
lblWeekDay.Text = day.ToString();
Of course, we could reduce it even further to :
DayOfWeek day = DayOfWeek.Sunday;
lblWeekDay.Text = day.ToString();
--
Truth,
James Curran
[erstwhile VC++ MVP]
Home:
www.noveltheory.com Work:
www.njtheater.com
Blog:
www.honestillusion.com Day Job:
www.partsearch.com
"Stuart Shay" <ss***@j51.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Lowell:
Thanks Got it too work
int wday = 0;
DayOfWeek day = (DayOfWeek) Enum.Parse(typeof(DayOfWeek),
wday.ToString()); lblWeekDay.Text = day.ToString();
Sunday is Displayed as the Label Text.
Best
SPS
"Lowell Heddings" <lo****@mindjunction.com> wrote in message
news:uz**************@TK2MSFTNGP11.phx.gbl... You can use:
System.DayOfWeek
Example:
System.DayOfWeek day = 0; // equals System.DayOfWeek.Sunday
MessageBox.Show(day.ToString()); // Outputs "Sunday"
Lowell
Stuart Shay wrote: Hello All:
I have some old ASP Code where it use the WeekdayName Function
How Can I get the following values in C#
wday = 1; => Sunday
wday = 4; => Wednesday
I see VB.NET has the Microsoft.VisualBasic.DateAndTime.WeekdayName, but
not in C#
Thanks
Stuart