0

我有两个文本框,它们是日期选择器。tbStartDatetbEndDate。用户应该只选择一个从星​​期一开始到星期五结束的日期,例如

tbStart.text = 05/11/2012 (Mon 5th November 2012)
tbEndDate.text = 09/11/2012 (Fri 11th November 2012)

我需要验证开始日期和结束日期分别是星期一和星期五。

我正在使用 asp.net (Visual Basic)。我的问题的最佳解决方案是什么?谢谢

解决:

Sub GetDayOfWeek()
Dim MyDate As Date = "2012/11/04"
        If MyDate.DayOfWeek.ToString() = "Sunday" Then
            Response.Write("Cannot be a weekend!")
         Else
            Response.Write("Weekday Detected!")
        End If
    End Sub
4

1 回答 1

1
Sub GetDayOfWeek()
Dim MyDate As Date = "2012/11/04"
        If MyDate.DayOfWeek.ToString() = "Sunday" Then
            Response.Write("Cannot be a weekend!")
         Else
            Response.Write("Weekday Detected!")
        End If
    End Sub
于 2012-11-04T23:39:05.850 回答