Skip to main content

CDate()

This function converst a valid date or time expression that is currently a string into a date type.  The expression can contain only the date, only the time or both.

Script

Sub Main   
    Dim myDate As Date
    Dim dateString As String
   
    dateString = "Sept 19, 1964"
    myDate = CDate(dateString)
    MsgBox myDate
   
    dateString = "07:45:00"
    myDate = CDate(dateString)
    MsgBox myDate
   
    dateString = "09/19/1964 07:45:00"
    myDate = CDate(dateString)
    MsgBox myDate

End Sub

IDEAScript Language