/// <Summary>
/// Whether it is a date string
/// </Summary>
/// <Param name = "strsource"> date string () </param>
/// <Returns> </returns>
Public static bool isdate (string strsource)
{
Return RegEx. ismatch (strsource, @ "^ (1 [6-9] | [2-9] \ D) \ D {2})-(0? [1, 13578] | 1 [02])-(0? [1-9] | [12] \ d | 3 [01]) | (1 [6-9] | [2-9] \ D) \ D {2})-(0? [13456789] | 1 [012])-(0? [1-9] | [12] \ d | 30) | (1 [6-9] | [2-9] \ D) \ D {2 }) -0? 2-(0? [1-9] | 1 \ d | 2 [0-9]) | (1 [6-9] | [2-9] \ D) (0 [48] | [2468] [048] | [13579] [26]) | (16 | [2468] [048] | [3579] [26]) 00)-0? 2-29-) $ ");
}
/// <Summary>
/// Whether it is a time string
/// </Summary>
/// <Param name = "Source"> time string (15:00:00) </param>
/// <Returns> </returns>
Public static bool Istime (string strsource)
{
Return RegEx. ismatch (strsource, @ "^ (20 | 21 | 22 | 23 | [0-1]? \ D): [0-5]? \ D: [0-5]? \ D) $ ");
}
/// <Summary>
/// Whether it is a date + time string
/// </Summary>
/// <Param name = "Source"> </param>
/// <Returns> </returns>
Public static bool isdatetime (string strsource)
{
Return RegEx. ismatch (strsource, @ "^ (1 [6-9] | [2-9] \ D) \ D {2})-(0? [1, 13578] | 1 [02])-(0? [1-9] | [12] \ d | 3 [01]) | (1 [6-9] | [2-9] \ D) \ D {2})-(0? [13456789] | 1 [012])-(0? [1-9] | [12] \ d | 30) | (1 [6-9] | [2-9] \ D) \ D {2 }) -0? 2-(0? [1-9] | 1 \ d | 2 [0-8]) | (1 [6-9] | [2-9] \ D) (0 [48] | [2468] [048] | [13579] [26]) | (16 | [2468] [048] | [3579] [26]) 00)-0? 2-29-) (20 | 21 | 22 | 23 | [0-1]? \ D): [0-5]? \ D: [0-5]? \ D) $ ");
}