Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch: 'date1'

Status
Not open for further replies.

carlosparedes

Programmer
Jun 10, 2007
12
GB
hi guys

I am trying to format the date, I get in input box, into ddmmyyyy (without separators).
I am getting the following error:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'date1'

I don't Know what I am doing wrong.

<Code>
Select Date: &nbsp;<input type="date" name="date1" size="16" valign="top">

<%Function FormatDateNoSep(date1, yrDig)
Dim strYYYY
Dim strMM
Dim strDD

strYYYY = CStr(DatePart("yyyy",date1))

if yrDig = 2 then strYYYY = Right(strYYYY, 2)


strMM = CStr(DatePart("m", date1))
If Len(strMM) = 1 Then strMM = "0" & strMM

strDD = CStr(DatePart("d",date1))
If Len(strDD) = 1 Then strDD = "0" & strDD

FormatDateNoSep = strMM & strDD & strYYYY

End Function %>

<% = FormatDateNoSep(date1(),4) %>


</code>


Can you help me
Thanks in advance

Sandra
 
1. As you're in the ASP forum it's reasonable to suppose you're using ASP. In ASP all code is processed on the server before the page is served to the client, so, as shown, your function will be processed before it gets any input. You need to use a Form element to contain your Input, then use the Action attribute of the form to redirect your date to the server to be processed.

2. The name of the Input element isn't the name of the variable containing the data.

3. I see from your history that you haven't given any feedback on any of the 6 questions that you have asked on these forums. Please read faq222-2244 to see how the forums work.

4. You should go back to the basics of ASP, starting from somewhere like
___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top