Mega Code Archive

 
Categories / VB.Net Tutorial / Date Time
 

Weekday Function

Option Strict On Public Module WeekdayFunction    Public Sub Main       Dim holiday As Date = #01/01/2006#       If Weekday(holiday, FirstDayOfWeek.Monday) <= 5 Then          Console.WriteLine("The holiday on {0}, is during the work week.", _                            FormatDateTime(holiday, DateFormat.LongDate))       Else          Console.WriteLine("The holiday on {0}, occurs during the weekend.", _                            FormatDateTime(holiday, DateFormat.LongDate))       End If    End Sub End Module The holiday on January 1, 2006, occurs during the weekend.