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

Converting a string to a date format?

Status
Not open for further replies.

questhaven

Programmer
Mar 28, 2001
81
US
Hi! Does anyone know if it is possible to convert something that is stored as a varchar in the database (such as 03/05) to a date format so I can do a date comparison in ASP/VBScript?
 
questhaven,

Yes.

In ASP create an ADO connection, SQL and pull back the data to your recordset.

As your are reading your data in, you can use the CDate function to convert it from a variant to a date and then do your tests. See FUNCTION: CDate( )
Assumes that you have a valid date format in the database. Otherwise you might have to write you own routine to convert it to a valid format prior to feeding through the CDate.

Hope this helps.
DougCranston
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top