Compare Validator to check mm/dd/yyyy

Discussion in 'ASP .Net Web Controls' started by Cam, Jul 6, 2004.

  1. Cam

    Cam Guest

    Hello,

    I have a compare validator control in my vb.net project. I have the TYPE
    set to date, the CONTROLTOVALIDATE set to the textbox, and the OPERATOR set
    to datatypecheck. I want the date only as mm/dd/yyyy (not mm/dd/yy). What
    is the best way to do this? Can I do it with the controls properties or
    must
    I do it in code? Thanks in advance.

    Cam
     
    Cam, Jul 6, 2004
    #1
    1. Advertising

  2. Cam

    DujHoD Guest

    How about a RegularExpressionValidator?


    "Cam" <> wrote in message news:<>...
    > Hello,
    >
    > I have a compare validator control in my vb.net project. I have the TYPE
    > set to date, the CONTROLTOVALIDATE set to the textbox, and the OPERATOR set
    > to datatypecheck. I want the date only as mm/dd/yyyy (not mm/dd/yy). What
    > is the best way to do this? Can I do it with the controls properties or
    > must
    > I do it in code? Thanks in advance.
    >
    > Cam
     
    DujHoD, Jul 6, 2004
    #2
    1. Advertising

  3. Hi Cam,

    As for your problem on validating a certain DateTime input value. I agree
    with DujHoD that the RegularExpressionValidator or CustomValidator may be
    more suitable for you.
    #CustomValidator Control
    http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconCustomValidatorCo
    ntrol.asp?frame=true

    #RegularExpressionValidator Control
    http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconRegularExpression
    ValidatorControl.asp?frame=true

    The CompareValidtor is used to compare two values or with another control's
    value. To valiating DateTime input with a specified format(such as
    mm/dd/yyyy... ) , its better to use regex. And here are some further
    resources on Regex with Date/Time validation:

    #RegEx Short Date Validation
    http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=474

    http://www.regexlib.com/DisplayPatterns.aspx

    Hope also helps. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    http://msdn.microsoft.com/asp.net/whidbey/default.aspx
     
    Steven Cheng[MSFT], Jul 7, 2004
    #3
  4. Cam

    Cam Guest

    Thanks, looks like I was using the wrong control. The links were helpful, I
    just have to learn to think about formating dates differently then i am use
    to (vb 6.0)

    Cam



    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > Hi Cam,
    >
    > As for your problem on validating a certain DateTime input value. I agree
    > with DujHoD that the RegularExpressionValidator or CustomValidator may be
    > more suitable for you.
    > #CustomValidator Control
    >

    http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconCustomValidatorCo
    > ntrol.asp?frame=true
    >
    > #RegularExpressionValidator Control
    >

    http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconRegularExpression
    > ValidatorControl.asp?frame=true
    >
    > The CompareValidtor is used to compare two values or with another

    control's
    > value. To valiating DateTime input with a specified format(such as
    > mm/dd/yyyy... ) , its better to use regex. And here are some further
    > resources on Regex with Date/Time validation:
    >
    > #RegEx Short Date Validation
    > http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=474
    >
    > http://www.regexlib.com/DisplayPatterns.aspx
    >
    > Hope also helps. Thanks.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    > Get Preview at ASP.NET whidbey
    > http://msdn.microsoft.com/asp.net/whidbey/default.aspx
    >
    >
    >
     
    Cam, Jul 7, 2004
    #4
    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. Robbo
    Replies:
    0
    Views:
    338
    Robbo
    Oct 30, 2003
  2. Ashraf Ansari

    convert MM/dd/yyyy format into dd/MM/yyyy

    Ashraf Ansari, Aug 30, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    806
    Alexey Smirnov
    Aug 30, 2007
  3. Gilles Ganault

    Converting DD MM YYYY into YYYY-MM-DD?

    Gilles Ganault, Aug 17, 2009, in forum: Python
    Replies:
    18
    Views:
    1,415
    Mark Tolonen
    Aug 20, 2009
  4. J P Singh
    Replies:
    4
    Views:
    300
    J P Singh
    Feb 10, 2004
  5. Assimalyst

    dd/mm/yyyy Date Compare Problem

    Assimalyst, Apr 28, 2006, in forum: Javascript
    Replies:
    12
    Views:
    273
    Dr John Stockton
    Apr 30, 2006
Loading...

Share This Page