Easy Tutorial
❮ Func Year Func Ubound ❯

VBScript CDate Function



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

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

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

Syntax

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

Example

Example 1

How to convert a string to a date:

Example 2

How to convert a number with delimiters to a date:

Example 3

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


❮ Func Year Func Ubound ❯