Validate Date range

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vavc1980
    New Member
    • Feb 2008
    • 25

    Validate Date range

    Hello,

    I have a couple of textboxes where I enter a date range (From - To), I need to validate that the Date From is greater (future) or at least equal to the Date From, or else give an error.
    I almost made it work, when I use the same format in the year (2 digits, or 4 digits) in both dates, but when one of them has a 2 digit year and the other 4 digit year, it does not work??

    Is there a simple way to do this? I've been looking in internet but so far I have not found any solution to this specific problem.

    example:
    Date From: 10/9/2008 Date To: 10/8/2008 <- works fine, I get the error
    Date From: 10/9/08 Date To: 10/8/2008 <- not working

    same thing when the 2 year digit is in Date To.

    I hope somebody can help me with this issue.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you could use a regex or some string functions to make all 2 digit years 4 digits and apply the validation afterwards.

    regards

    Comment

    Working...