We help IT Professionals succeed at work.

Regular Expression for yyyymmdd in c#.net

praveen1981
praveen1981 asked
on
Medium Priority
5,844 Views
Last Modified: 2012-05-12
Hi
can you please say me how to do Regular Expression for yyyymmdd in c#.net

Comment
Watch Question

^([2-9]\d{3}((0[1-9]|1[012])(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])(29|30)|(0[13578]|1[02])31)|(([2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00))0229)$
DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.GetCultureInfo("en-US"));

Try above code.
Team Lead
CERTIFIED EXPERT
Commented:
Hello, use this

^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$

Author

Commented:
It Solved