Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

VBScript CDate Function

VBScript CDate Function


VBScript reference manual Complete VBScript Reference Manual


The CDate function converts a valid date and time expression to the Date type and returns the result. p>

**Tip:** Use the IsDate function to determine whether date can be converted to a date or time.

**Note:** The IsDate function uses local settings to detect whether a string can be converted to a date (in all languages, "January" is not a month).

Syntax

CDate(date)

Parameters Description
date Required. Any valid date expression (such as Date() or Now()).

Example

Example 1

How to convert a string to a date:

Try it »

Example 2

How to convert delimited numbers to a date:

Try it »

Example 3

How to use CDATE to convert a string to a time object:

Try it »


VBScript reference manual Complete VBScript Reference Manual