Type conversion in VBScript

We can check the variable type by using TypeName. To change from one type to other we can use different functions.

Expression to Integer by Cint
Dim v1
v1=5.43    	
Response.Write "Type of " & TypeName(v1)
Response.Write "<br>"
Response.Write CInt(v1)  ' Output will be 5
If the last line is changed by using Cdbl then output will be like this
Response.Write CDbl(v1) ' Output will be 5.43

CDate

CDate() converts an expression to a Date value. String-to-date conversion depends on the server locale, so avoid ambiguous numeric date strings when possible.

Dim eventDate
eventDate = CDate("September 22, 2026")
Response.Write eventDate

When you already have numeric year, month, and day components, DateSerial() is usually clearer.


ASP Home






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer