vba text format date code example
Example: vba date format
Dim myDate As Date, strDate As String
myDate = CDate("2021-01-28") ' Date
strDate = Format(myDate, "YYYY-MM-DD") ' String
strDate = Format(myDate, "DD/MM/YYYY hh:mm:ss")
Dim myDate As Date, strDate As String
myDate = CDate("2021-01-28") ' Date
strDate = Format(myDate, "YYYY-MM-DD") ' String
strDate = Format(myDate, "DD/MM/YYYY hh:mm:ss")