ASP makes it very easy to convert a string to a date format using built-in VBScript functionality. We're going to use the CDate function to accomplish this. The CDate function has one argument, which is the text to be converted to date format.
Here's how to do it:
- Open up your text editor and type the following piece of code:
MyDate = "April 12, 1978"
- Now, use the function this way to convert the date, and print the new format to the screen:
The result will be displayed in your browser like this: