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