Illustrate the Format method
Sub dateFormats()
Dim strDateString As String
strDateString = "m/d/yy: " & Format(Now, "m/d/yy") & vbCrLf & _
"d-mmm-yy: " & Format(Now, "d-mmm-yy") & vbCrLf & _
"d-mmmm-yy: " & Format(Now, "d-mmmm-yy") & vbCrLf & _
"mmmm d, yyyy: " & Format(Now, "mmmm d, yyyy") & vbCrLf & _
"ddd: " & Format(Now, "ddd") & vbCrLf & _
"dddd: " & Format(Now, "dddd") & vbCrLf & _
"ddddd: " & Format(Now, "ddddd") & vbCrLf & _
"dddddd: " & Format(Now, "dddddd") & vbCrLf & _
"Hh:Nn:Ss AM/PM: " & Format(Now, "Hh:Nn:Ss AM/PM") & vbCrLf & _
"ttttt: " & Format(Now, "ttttt") & vbCrLf & _
"vbShortDate: " & FormatDateTime(Now, vbShortDate) & vbCrLf & _
"vbLongDate: " & FormatDateTime(Now, vbLongDate) & vbCrLf & _
"vbGeneralDate: " & FormatDateTime(Now, vbGeneralDate)
MsgBox strDateString
End Sub
Related examples in the same category