我想将字符串“mm/dd/yy hh:mm AM/PM”转换为日期“mm/yyyy”
为什么会输出以下代码11-2-2015
?
Sub Test()
Dim yourStringDate As String
Dim yourDateVariable As Date
yourStringDate = "11/2/15 12:00 AM"
yourDateVariable = Format(CDate(yourStringDate), "mm/yyyy")
MsgBox yourDateVariable
End Sub