Date validation problem

Discussion in 'ASP .Net Web Controls' started by John, Feb 27, 2005.

  1. John

    John Guest

    Hi

    I am using a compare validator to validate a text field for a date value.
    The problem is that the validator does not accept a single digit year like
    1/1/5 but would accept a two digit or four digit year like 1/1/05 or
    1/1/2005. What is the problem and how can I fix it?

    Thanks

    Regards
    John, Feb 27, 2005
    #1
    1. Advertising

  2. John

    Riki Guest

    John wrote:
    > Hi
    >
    > I am using a compare validator to validate a text field for a date
    > value. The problem is that the validator does not accept a single
    > digit year like 1/1/5 but would accept a two digit or four digit year
    > like 1/1/05 or 1/1/2005. What is the problem and how can I fix it?


    If it's customary in your region to write a date as 1/1/5, then
    apparently, the .NET framework is not aware of that.

    So, I'll guess that you'll have to train your users to write 1/1/05,
    or else you'll have to write a custom validator or a Regular Expression
    validator.

    --

    Riki
    Riki, Feb 27, 2005
    #2
    1. Advertising

  3. John

    John Guest

    Are you kidding? 1/1/5 is valid date everywhere. Sure day and month can swap
    but otherwise it is a perfectly valid date. If framework does not understand
    it then I'd say it is a bug in the fw.

    Regards

    "Riki" <> wrote in message
    news:...
    > John wrote:
    > > Hi
    > >
    > > I am using a compare validator to validate a text field for a date
    > > value. The problem is that the validator does not accept a single
    > > digit year like 1/1/5 but would accept a two digit or four digit year
    > > like 1/1/05 or 1/1/2005. What is the problem and how can I fix it?

    >
    > If it's customary in your region to write a date as 1/1/5, then
    > apparently, the .NET framework is not aware of that.
    >
    > So, I'll guess that you'll have to train your users to write 1/1/05,
    > or else you'll have to write a custom validator or a Regular Expression
    > validator.
    >
    > --
    >
    > Riki
    >
    >
    John, Feb 27, 2005
    #3
    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. Matt
    Replies:
    1
    Views:
    588
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,229
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    504
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    707
    Richard Heathfield
    Nov 8, 2003
  5. Matt
    Replies:
    11
    Views:
    397
    Aaron Bertrand [MVP]
    Nov 8, 2003
Loading...

Share This Page