- VBScript - Home
- VBScript - Overview
- VBScript - Syntax
- VBScript - Enabling
- VBScript - Placement
- VBScript - Variables
- VBScript - Constants
- VBScript - Operators
- VBScript - Decisions
- VBScript - Loops
- VBScript - Events
- VBScript - Cookies
- VBScript - Numbers
- VBScript - Strings
- VBScript - Arrays
- VBScript - Date
- VBScript - Procedures
- VBScript - Dialog Boxes
- VBScript - Object Oriented
- VBScript - Reg Expressions
- VBScript - Error Handling
- VBScript - Misc Statements
- VBScript Useful Resources
- VBScript - Questions and Answers
- VBScript - Quick Guide
- VBScript - Useful Resources
- VBScript - Discussion
VBScript CDate Function
The Function converts a valid date and time expression to type date.
Syntax
cdate(date)
Example
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
a = cdate("Jan 01 2020")
document.write("The Value of a : " & a)
document.write("<br />")
b = cdate("31 Dec 2050")
document.write("The Value of b : " & b)
</script>
</body>
</html>
When you save it as .html and execute it in Internet Explorer, then the above script will produce the following result −
The Value of a : 1/01/2012 The Value of b : 31/12/2050
vbscript_date.htm
Advertisements