Created
June 6, 2012 03:38
-
-
Save andrewjamesford/2879742 to your computer and use it in GitHub Desktop.
Time validation in ASP.Net MVC using a regular expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DisplayFormat(ApplyFormatInEditMode = true,DataFormatString = "{0:HH:mm}")] | |
[RegularExpression(@"^(?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$", ErrorMessage = "Invalid time.")] | |
public DateTime? YourDateTime { get; set; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment