Heres my problem:

I need to switch the order of a set of dates to match the database requirements.

i have a form field that if the date is entered another fields date field is 
automatically filled with 3 years added for an expiry date.
the date are formated like this: dd/mm/yyyy.

basically my code is working 98% of the time but a few dates are giving me trouble 
here they are:

certification issued date is 02/12/2003 then i add 3 years and this is what i get 
12/02/2006.(Date format dd/mm/yyyy) 
here's the code:
begin code------------------>

Function CertificationExpiry_onblur()

 Set theForm = document.DriverCert
 Dim strdtDate
 Dim strExpDate
 Dim strYear
 Dim strDay
 Dim strMonth
 Dim lenDay
 Dim lenMonth
 Dim strFinalDate
 If ((theForm.ExaminationDate.value)<> "") Then
 strdtDate = (theForm.ExaminationDate.value)
 
 strdtDate = formatdatetime(strdtDate, [mm/dd/yyyy])

'Extract the year
strYear = year(strdtDate)

'Extract the month and then make sure it has 2 digits using the len function
strMonth = month(strdtDate)
lenMonth = len(strMonth)
   If lenMonth = 1 Then
      strMonth = "0" & strMonth
   end if

'Extract the day and then make sure it has 2 digits using the len function
strDay = day(strdtDate)
lenDay = len(strDay)
    If lenDay = 1 Then
        strDay = "0" & strDay
        strFinalDate = strMonth & "/" & strDay & "/" & (Cint(strYear)+3)
    else
        'Now put it all together in a nice little format
        strFinalDate = strDay & "/" & strMonth & "/" & (Cint(strYear)+3)
    end if
    theForm.CertificationExpiry.value = strFinalDate
 
 end if
 
end Function

------------> end code

Any help with this issue would be awsome cause I don't have much hair left.

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to