试试
原文链接:https://www.f2er.com/vb/255070.htmlDateTime.ParseExact()
来自MSDN的数据示例:
Dim dateString,format As String Dim result As Date Dim provider As Globalization.CultureInfo = Globalization.CultureInfo.InvariantCulture ' Parse date and time with custom specifier. dateString = "20090910" format = "yyyyMMdd" Try result = Date.ParseExact(dateString,format,provider) Console.WriteLine("{0} converts to {1}.",dateString,result.ToString()) Console.ReadLine() Catch e As FormatException Console.WriteLine("{0} is not in the correct format.",dateString) End Try