Date type in ASP/Javascript/SQL

  • Thread starter Jan Paul van de Berg
  • Start date
J

Jan Paul van de Berg

How do I handle date methods like getDate() on values I get from a
recordset? Example:

rs.Source= "Select SomeDateField From SomeTable"
....

1)
Response.write(rs.Fields.Item("SomeDateField"));
output: 11/16/2006

2)
Response.write(String(rs.Fields.Item("SomeDateField")));
output: Thu Nov 16 00:00:00 EST 2006

Since there's a difference I would expect rs.Fields.Item("SomeDateField")
is a date type. But I cannot apply date methods:

3)
Response.write((rs.Fields.Item("SomeDateField").Value).getDate());
error: 'rs.Fields.Item(...).Value' is null or not an object

4)
Response.write((rs.Fields.Item("SomeDateField")).getDate());
error: Object doesn't support this property or method

5)
Response.write(CDate(rs.Fields.Item("SomeDateField")).getDate());
error: Object expected
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,135
Messages
2,570,783
Members
47,339
Latest member
flaviu2

Latest Threads

Top