Be the first user to complete this post

  • 0
Add to List

VBA-Excel: Date-Time Functions – CDate()

Description: 

The CDate() function converts a valid date and time expression to Type Date

Format:

CDate(date)

Arguments:
  • date
    • Mandatory
    • The expression will be converted into Type Date


Example:

Function FnCDate()
 Dim strDate
 Dim intDate
 Dim strTime

  strDate = "June 24, 2013"    

    intDate = #12/6/1985#    

    strTime = "15:30:15 PM"

    MsgBox CDate(strDate)    

    MsgBox CDate(intDate)    

    MsgBox CDate(strTime)

End Function
Cdate()
Cdate()



Also Read:

  1. VBA-Excel: Arrays – One Dimension, Static Array
  2. VBA-Excel : Strings Functions – Right
  3. VBA-Excel : 3D-Ranges - Working with Multiple WorkSheets At The Simultaneously
  4. VBA-Excel: Date-Time Functions – DateSerial()
  5. VBA-Excel: String Functions – RTrim()
  6. VBA-Excel: Date-Time Functions – DatePart()
  7. VBA-Excel: Date-Time Functions – IsDate()
  8. VBA-Excel: Array Functions – Split()