sample how to format date and time format in VBA access 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")