Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

HTML Reference
Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

CDate

The CDate function will convert an ASP variant value to a date value if possible. If it is not possible, then the script engine will throw a runtime error.

If you wish to trap the error that occurs when converting an invalid variable, you can do so with the code shown below:

Dim sValue
Dim dValue

sValue ="12/30/02"
On Error Resume Next
dValue = CDate(sValue)
If Err.Number <> 0 Then
    Response.Write "An Error occurred converting to date: " & sValue
End If


Dates usually take the following forms:

11/03/2002
11-03-2002
11/03/2002 15:32:00
11-03-2002 14:59:59
Jan 3, 2002 2:32pm

Orvado Technologies

ASP Nuke CMS
Free Open Source
Content Manager
HomeFix Boards
Home Remodeling
Message Boards

Contact Us | Contribute | About | Site Map



"I do not think much of a man who is not wiser today than he was yesterday." - Abraham Lincoln

©2010 San Diego Web Design - Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.