[英]vb.net validate days from selected date fields
I have two textboxes which are date pickers. 我有两个文本框,它们是日期选择器。
tbStartDate
and tbEndDate
. tbStartDate
和tbEndDate
。 The user should only pick a date that starts on a Monday and ends on a Friday, eg 用户只能选择一个从星期一开始到星期五结束的日期,例如
tbStart.text = 05/11/2012 (Mon 5th November 2012)
tbEndDate.text = 09/11/2012 (Fri 11th November 2012)
I need to validate that the start and end dates are Monday and Friday respectively. 我需要确认开始日期和结束日期分别是星期一和星期五。
I am using asp.net (Visual Basic). 我正在使用asp.net(Visual Basic)。 What is the best solution to my problem?
解决我的问题的最佳方法是什么? Thanks
谢谢
RESOLVED: 解决:
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
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.