Question Change Format from date to Day of week

kieran82

Member
Joined
Feb 21, 2010
Messages
19
Programming Experience
Beginner
I want to convert =now date value and i want to change that to the day of the week (eg. Friday). I need to do this to compare it with which day it is today.
 
A Date value has a DayOfWeek property. Also, you can use a custom format string to display the day of the week.
VB.NET:
Select Case Date.Now.DayOfWeek
    Case DayOfWeek.Sunday
        MessageBox.Show("Today is Sunday")
    Case DayOfWeek.Monday
        MessageBox.Show("Today is Monday")
    Case DayOfWeek.Tuesday
        MessageBox.Show("Today is Tuesday")
    Case DayOfWeek.Wednesday
        MessageBox.Show("Today is Wednesday")
    Case DayOfWeek.Thursday
        MessageBox.Show("Today is Thursday")
    Case DayOfWeek.Friday
        MessageBox.Show("Today is Friday")
    Case DayOfWeek.Saturday
        MessageBox.Show("Today is Saturday")
End Select

MessageBox.Show(String.Format("Today is dddd, d MMMM, yyyy", Date.Now))
 
Back
Top