Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate DateTime HourMinute

Status
Not open for further replies.

shangrilla

Programmer
Nov 21, 2001
360
US
\d{2}/\d{2}/\d{2,4} \d{2}:d{2} checks that the date entered in a textbox is in format mm/dd/yy hh:mm or mm/dd/yyyy hh:mm

How can I check for:
Months between 1-12
Days between 1-31
Hours between 0-23
Minutes between 0-59

Thanks
 
Shang: Although not a validation formatted expression, you can always check in code (as one option), e.g.,:

If Month(myDate.Text) = 5 Then
'code
End If

If Day(myDate.Text) < 15 Then
'code
End If

...and so on. Just an idea (requires a postback unless you change this into java).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top