ASP Hosting sale!
1,000MB space, 40GB transfer, 1 SQL Server 2000 db! - $9.95 per month*!
Limited Time Offer!

aspdev | articles | tutorials | forums

ASPdev -> ASP Articles -> ASP - Convert String to Date

ASP - Convert String to Date

ASP makes converting string to date very easy. We’re going to use the CDate ASP/VBScript function in our ASP code to convert a string to a date value.

ASP CDate function has the following syntax:

CDate (Date)

ASP CDate function has 1 string argument, which is the string to be converted to date.
The CDate function converts any valid date/time string expression to Date variant subtype.

Consider the following use of ASP CDate function, to convert sDate string to date:

<%
sDate = "January 13, 1970"
Response.Write CDate(sDate)
%>

The result displayed in your browser will be:

1/13/70




Contact Us