问题
I have one more time a problem:
I want to convert from Strings to dates in VBA
The Strings look like: YYYY-DD-MM
The date should be like: DD.MM.YYYY
I know, normally you do this with the method cdate(), but it doesn't work here. I think it's because the structure of the string is bad to convert.
thanks for your help
InformatikBabo
回答1:
Sub Main()
Dim strDate As String
strDate = "2013-06-11"
Debug.Print "Original Date: ", strDate
Debug.Print "CDate() Conversion: ", CDate(strDate)
Debug.Print "Format() as String: ", Format(strDate, "DD.MM.YYYY")
End Sub
and the Immediate Window shows
来源:https://stackoverflow.com/questions/19814978/vba-convert-to-date