Sunday 20 November 2011

Get Day of the Week

A simplest function to get the day of the week

Sub DisplayTime()
MessageBox.Show(GetTime)
End Sub

Function GetTime() As String
If My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Saturday Or _
My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Sunday Then
Return "Happy Weekend!"
Else
Return "Happy Weekday! Don't work too hard!"
End If
End Function

No comments:

Post a Comment