FormatDateTime error in MysQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • janetopps
    New Member
    • Oct 2008
    • 20

    FormatDateTime error in MysQL

    This is an asp page which adds a template to a mysql database. it returns this error




    Microsoft VBScript runtime error '800a000d'

    Type mismatch: 'FormatDateTime '


    /temps.asp, line 111

    and the code in line 111 is


    Code:
    <td align="center" title="Created on <%=FormatDateTime(sDATE,1)%>"><%=sDATE%></td>

    more code from the page concerened


    Code:
    SQL = "SELECT ID, fldNAME, fldDATE FROM nm_tbl_template ORDER BY " & ORD
        Call OPEN_DB()
        Set RS = Server.CreateObject("ADODB.Recordset")
        RS.LockType   = 1
        RS.CursorType = 0
        RS.Open SQL, MyConn	
        	IF NOT RS.EOF THEN
        		strRETURNED_DATA = RS.getrows
        	ELSE
        		EOF_VAL = True
        	END IF	
        RS.close
        Set RS = Nothing
        MyConn.close			
        Set MyConn = Nothing    
        
        IF Not EOF_VAL = True Then
        	intNUM_COL=ubound(strRETURNED_DATA,1)
        	intNUM_ROW=ubound(strRETURNED_DATA,2)
        	FOR intROW_COUNTER = 0 TO intNUM_ROW
        		ID     = strRETURNED_DATA(0,intROW_COUNTER)
                NAME   = strRETURNED_DATA(1,intROW_COUNTER)
                sDATE  = strRETURNED_DATA(2,intROW_COUNTER)
                %>
    			<tr onMouseOver="bgColor='WhiteSmoke'" onMouseOut="bgColor='White'">
    				<td align="Center" width="30">
    					<table cellpadding="2" cellspacing="0" border="0" width="30">
    						<tr>
    							<td><% IF Trim(arrLEVEL(17)) = "1" THEN %><a href='template_edit.asp?ID=<%=ID%>'><img src="Images/ico_edit.gif" width="15" height="15" alt="Edit Template" border="0"></a><%Else%>&nbsp;<%End If%></td>
                                <td><% IF Trim(arrLEVEL(18)) = "1" THEN %><%IF IsMSIE = True THEN%><a style="cursor:pointer;cursor:hand;" onclick="DeleteTemplate('<%= ID %>','<%= FIX_JS_STR(NAME) %>')"><%Else%><a href='template_del.asp?ID=<%=ID%>'><%End If%><img name="image<%=ID%>" src="Images/ico_del.gif" width="15" height="15" alt="Delete" border="0" onMouseOver="image<%=ID%>.src='Images/ico_del_on.gif';" onMouseOut="image<%=ID%>.src='Images/ico_del.gif';" /></a><% Else%>&nbsp;<% End If %></td>
    						</tr>
    					</table>
    				</td>
    				<td width="39" align="Center"><%=ID%></td>
    				<td style="cursor:pointer;cursor:hand;" onClick="window.location='template_view.asp?ID=<%=ID%>'"><%=NAME%></td>
    				<td align="center" title="Created on <%=FormatDateTime(sDATE,1)%>"><%=sDATE%></td>
                    <td width="15"><a href="news_add.asp?TID=<%=ID%>"><img src="images/template.gif" width="15" height="15" alt="Apply Template" border="0"></a></td>
                    <td width="15"><a href='template_view.asp?ID=<%=ID%>'><img src="images/view_zoom.gif" width="15" height="15" alt="Preview Template" border="0"></a></td>
    			</tr>            
                <%
        	NEXT
        ELSE
            %>    
            <tr><td colspan="4">No template has been found.</td></tr>
            <%
        END IF       
        %>
    can anyone tell offhand what is wrong with the particular line or code? or what i could try to get rid of the error?
  • janetopps
    New Member
    • Oct 2008
    • 20

    #2
    ive got the solution now,

    Code:
    <%
         dt = strRETURNED_DATA(2,intROW_COUNTER)
         If IsDate(dt) Then 
             dt = FormatDateTime(CDate(dt))
         Else
             dt = "N/A" ' or whatever
         End If
    %>
    <td align="center" title="Created on <%=dt%>"><%=dt%></td>
    ...

    Comment

    Working...