Date validation

Results 1 to 5 of 5

Thread: Date validation

  1. #1
    Join Date
    Dec 1969

    Default Date validation

    How to validate date if users input a date?

  2. #2
    BS Guest

    Default RE: Date validation

    For date validations u will have to use a function in JScript/JavaScript That checks the length of the date and then the validity of the dates etc and other such conditions.

  3. #3
    -Rob- Guest

    Default RE: Date validation

    Here is a VBScript function I use that might be helpful.<BR><BR>Function IsValidDate( pDate )<BR> &#039 Purpose : Determine if a valid date has been entered<BR> &#039 Parameters: pDate - date to validate<BR> &#039 Returns : True if valid. Otherwise, false<BR> &#039 Notes : The date must be entered as the format:<BR> &#039 00/00/0000 (e.g. 02/03/2000)<BR> &#039 -----------------------------------------------------------<BR><BR> dim fRetVal<BR><BR> on error resume next<BR> <BR> if pDate = "" then<BR> &#039 No date was provided therefore, do not validate as bad<BR> fRetVal = true<BR> else<BR> &#039 A value was entered, determine if its a valid date<BR> fRetVal = ( isdate(pDate) ) and ( (len(pDate)=10) )<BR> end if<BR><BR> IsValidDate = fRetVal<BR><BR>End Function<BR>

  4. #4
    DL Guest

    Default RE: Date validation

    vbscript:<BR>IsDate(expression)<BR><BR>this function returns a true or false.

  5. #5
    Guido San Alredo Santiago Guest

    Default RE: Date validation

    Well thats a good general question...<BR>Validating as far as len of how many characters were given for a certain date format (Len(pDate) = 10) works if that&#039s all you care about but if your dumping this to a database or need strict control over the range of dates or date format I would use a regular expression.<BR><BR>Dim MyRegExpression, MyResult<BR><BR>Set MyRegExpression = new RegExp<BR>MyRegExpression.Pattern = "([1-12]){1}/{1}([1-31]){1}/{1}([1-3000]){1}<BR>MyRegExpression.Global = True<BR>MyRegExpression.Ignore = True<BR>MyResult = MyRegExpression.Execute(myStringToTest)

Posting Permissions

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