Date Validation Expression and Leap Year

Discussion in 'ASP .Net' started by Hai Nguyen, Feb 26, 2004.

  1. Hai Nguyen

    Hai Nguyen Guest

    I want to validate a textbox with date in the right format. I already have
    it worked. However, my validation expression does not solve the # of days in
    Feb; for isntance it does not solve for leap year like on Feb there are
    maybe 28 or 29 days

    Thank for any help
     
    Hai Nguyen, Feb 26, 2004
    #1
    1. Advertising

  2. Hai Nguyen

    Hans Kesting Guest

    "Hai Nguyen" <> wrote in message
    news:%23Ex70rJ$...
    > I want to validate a textbox with date in the right format. I already have
    > it worked. However, my validation expression does not solve the # of days

    in
    > Feb; for isntance it does not solve for leap year like on Feb there are
    > maybe 28 or 29 days
    >
    > Thank for any help
    >
    >


    I am guessing (as you didn't specify it) that you are using a
    RegularExpressionValidator
    and that you want a RE that correctly checks for leapdays.
    That can't be done (or at least not without a very complicated RE).
    You already have a RE that checks if the string "looks like it could be a
    date".
    You could add a CustomValidator with server-side code that checks if it is
    a real date ("does DateTime.Parse accept it?") and even add a client-side
    function that does the same.

    Hans Kesting
     
    Hans Kesting, Feb 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wen
    Replies:
    4
    Views:
    480
    Simon Saunders
    Dec 12, 2003
  2. Protoman
    Replies:
    14
    Views:
    562
  3. Replies:
    8
    Views:
    526
    Howard
    Mar 30, 2007
  4. Replies:
    39
    Views:
    1,686
    Charlie Gordon
    Nov 12, 2007
  5. David Woodward
    Replies:
    5
    Views:
    426
    Dr John Stockton
    Feb 2, 2004
Loading...

Share This Page