VB-Scripting CDate v/s IsDate function

Function Name:- Cdate

Meaning :- Returns expression in the form of variant date.

Syntax:- Cdate(date)

  • date argument should be valid date format
  • CDate recognizes date formats according to the locale setting of your system.

Function Name:- IsDate

Meaning :- Returns Boolean value, telling whether date conversion of expression is possible or not

Syntax:- IsDate(expression)

  • Returns “True” incase conversion is possible , else returns “False”


  • Dim sDate,sTime ‘Delcaring Variables
  • sDate = “May 22, 2013” ‘Delcaring Date 
  • MsgBox CDATE(sDate) ‘Returns Date As per your local system date Format
  •  MsgBox ISDATE(sDate) ‘Returns “True” 
  • sTime=”22:14:12PM” ‘Declaring Time 
  • MsgBox CDATE(sTime) ‘Returns time as per your local system timing format 
  • MsgBox ISDATE(sTime) ‘Reurns “True” 
  • sDate = “UFTHelp” ‘Passing invalid dates 
  • MsgBox ISDATE(sDate) ‘Returns “False”
  • MsgBox CDATE(sDate) ‘Returns Runtime error

Leave a Reply

Your email address will not be published. Required fields are marked *