Is Date String by regex - CSharp System

CSharp examples for System:DateTime Format

Description

Is Date String by regex

Demo Code


using System.Globalization;
using System.Text.RegularExpressions;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;//from w w w  .j  a  va 2  s. c  o m

public class Main{
            public static bool IsDateString(string str)
            {
                return Regex.IsMatch(str, @"(\d{4})-(\d{1,2})-(\d{1,2})");
            }
}

Related Tutorials