Date validation

Results 1 to 4 of 4

Thread: Date validation

  1. #1
    Matt Harvey Guest

    Default Date validation

    I have an ASP page in which a user selects month, date and year from drop down list boxes. Other information is also inputed. There is a submit button defined by &#060;INPUT NAME=&#039addrec&#039 TYPE=button VALUE="Add Record" onclick="fRequire(enterby,sevlev,sDescript);"&#062 ; which adds the information to my DB. I was wondering how one could check whether or not the date that is selected (which is concatenated in a text string as (sDateNeed = strMonthNeed + "/" + strDayNeed + "/" + strYearNeed)) is the present day or in the future.<BR><BR>Thanks, <BR><BR>Matt<BR>

  2. #2
    KPW Guest

    Default RE: Date validation

    Try this:<BR><BR>If CDate(sDateNeed) = Date Then<BR>&#039 --- the date is today&#039s date ---<BR>Else<BR>&#039 --- the date is not today&#039s date ---<BR>End If<BR><BR>

  3. #3
    Matt Harvey Guest

    Default RE: Date validation

    This code only checks if it is today or not. I need to check whether or not it&#039s a future date or not, as past dates can&#039t be allowed

  4. #4
    Join Date
    Dec 1969

    Default RE: Date validation

    Matt,<BR>I am not sure if this will work but maybe you could try something like this...<BR><BR>sDateNeed = strMonthNeed + "/" + strDayNeed + "/" + strYearNeed<BR><BR>IF cDate(sDateNeed) &#062; date() THEN &#039date is greater so in future?<BR>bla bla bla<BR>END IF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts