ValidationExpression for dd-MMM-yyyy including leap years

Posted on 2008-11-12
Last Modified: 2013-12-17
Hi I have the following below. Its just a sample. I want the validatior to alert when 30-Feb entered and also alert when 29-Feb entered when not a leap year.

This question under the accepted solution has it for the format  ddmmyyyy.

Could anyone help?
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><img id="btn" src="Images/calendar.png" />

    <cc1:CalendarExtender PopupButtonID="btn" Format="ddMMyyyy" TargetControlID="TextBox1" ID="cal" runat="server"></cc1:CalendarExtender>

    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 

        ControlToValidate="TextBox1" ErrorMessage="Not a valid date" 



Open in new window

Question by:caoimhincryan
    LVL 16

    Expert Comment

    by:Gyanendra Singh
    use this


    This patteren accepts '.' '-' and '/'

    Author Comment

    That works good but would you have an expression that allows it for dd-MMM-yyyy i.e- 13-Nov-2008. I have the wrong format in my code snippet above. Sorry about that.
    LVL 16

    Expert Comment

    by:Gyanendra Singh
    ohh you want word ... let me try

    Author Comment

    Any luck BondinASP?

    Accepted Solution


    I think i may have solved it. This has the format dd-MMM-yyyy and also checks for leap years and months that don't have 31 days.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now