取决于您是在寻找日期还是字符串作为输出。以下是如何做到这两点。
Dim strDateTime As String
Dim strDate As String
Dim s() As String
Dim pureDate As Date
strDateTime = "7/12/2012 3:41"
strDate = Split(strDateTime, " ")(0) ' "7/12/2012"
pureDate = CDate(strDate) ' 7 Dec 2012 (in my locale)
' ... results may be ambiguous depending on your locale
'Another way to get a Date, not blindly using CDate:
s = Split(strDate, "/")
' if date in day/month/year format:
pureDate = DateSerial(CInt(s(2)), CInt(s(1)), CInt(s(0))) ' 7 Dec 2012
' or, if date in month/day/year format:
pureDate = DateSerial(CInt(s(2)), CInt(s(0)), CInt(s(1))) ' 12 July 2012