Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

VBScript CDate function


May 13, 2021 VBScript


Table of contents


VBScript CDate function

The VBScript CDate function returns an expression that has been converted to The Date sub-type Variant.


VBScript CDate function Complete VBScript reference manual

The CDate function converts a valid date and time expression to a date type and returns the results. 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 strings can be converted to dates ("January" is not a month in all languages).

Grammar

CDate(date)

Parameters

parameter describe
date Required.Any valid date expression (such as Date () or now ()).


Instance 1

How to convert a string to a date:

<script type="text/vbscript">

d=CDate("April 22, 2010")

</script>

Try it out . . .

Instance 2

How to convert a number with separators to a date:

<script type="text/vbscript">

d=CDate(#4/22/10#)

</script>

Try it out . . .

Instance 3

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

<script type="text/vbscript">

d=CDate("3:18:40 AM")

</script>

Try it out . . .


VBScript CDate function Complete VBScript reference manual

Related articles

VBScript IsDate function