Created
January 23, 2013 02:18
-
-
Save yujuwon/4601252 to your computer and use it in GitHub Desktop.
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
public bool IsDate(String date) | |
{ | |
bool result = true; | |
String datePattern = @"^(19[0-9]{2}|2[0-9]{3})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)$"; | |
if(Regex.IsMatch(date, datePattern) == false) | |
{ | |
result = false; | |
} | |
return result; | |
} | |
public bool IsTime(String time) | |
{ | |
bool result = true; | |
String timePattern = @"^([0-9]{2}):([0-9]{2}):([0-9]{2})$"; | |
if(Regex.IsMatch(time, timePattern) == false) | |
{ | |
result = false; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment