Converting DayOfWeek enum to a string repesenting the day

date, dayofweek, select-case, vb.net

Solution

A simpler way:

Dim day As String = Date.Today.DayOfWeek.ToString()

Problem

I was wondering if there was a way to directly convert the integer `DayOfWeek` returns into a string representing the day like Monday, Tuesday etc. Sample code: ``` MessageBox.Show(Date.Today.DayOfWeek) ``` This will return `6` (as of today). Is there a way to directly convert this into `Saturday`, for example? I don't really care what it really converts it into, but I want to do away with my Select Case: ``` Select Case Date.Today.DayOfWeek Case 0 day = "Sunday" Case 1 day = "Monday" Case 2 day = "Tuesday" Case 3 day = "Wednesday" Case 4 day = "Thursday" Case 5 day = "Friday" Case 6 day = "Saturday" Case Else day = "Apocalypse: we're all boned." End Select ``` Thanks :)

Original source