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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates in a recordset not displayed correctly

Status
Not open for further replies.

lupidus

MIS
Joined
Jun 1, 2003
Messages
30
Location
US
The problem is that dates are showing up incorrectly when returned from a stored procedure: i.e. 12:00:00 AM (when using CDate conversion), or 12/30/1899 (via rs("columnname").Value)

Here is the ASP code:
Code:
If not rs.BOF and not rs.EOF Then
	Do Until rs.EOF
	%> <tr>
	<td><%=rs("OSVer")%></td> <%
		Vars = rs2("Vars") + "   "
		do while instr(2,Vars,";")
			
			VarName = cstr( left( Vars, instr(1,Vars,";") - 1 ) )
			
			Response.Write("<td>")
			
			if not isnull(rs(VarName)) then
				if rs(VarName).Type = 135 then ' isdate (ADODataTypeEnum values: 135=adDBTimeStamp)
					d = rs(VarName)
				'	Response.Write(CDate(rs(VarName))) ' date shows up as 12:00:00 AM
					Response.Write(FormatDateTime(rs(VarName),2) )	' date shows up as 12/30/1899
				else							' non date 
					Response.Write(rs(VarName).Value)
				end if
			end if
			Response.Write("</td>")
			Vars = mid(Vars, instr(1,Vars,";") + 1)
			
		Loop
		rs.MoveNext
		%> </tr> <%
	Loop
	
End If

Vars is just a semicolon delimited list of column names to return. Each VarName is the column name.

Thanks for any help.
 
I think you have posted in the wrong forum (this is for ASP.NET). For ASP related questions try forum333

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top