6
我已經通過字符串文本文件即將通過的SSIS包形式:VB.NET:如何將字符串轉換爲日期?
"20090910" (string)
和它需要
2010-09-01 00:00:00 (Date)
有什麼建議?
我已經通過字符串文本文件即將通過的SSIS包形式:VB.NET:如何將字符串轉換爲日期?
"20090910" (string)
和它需要
2010-09-01 00:00:00 (Date)
有什麼建議?
嘗試從MSDN DateTime.ParseExact()
實例與您的數據:
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
上讓我來試試taht我想類似的東西前面沒有工作... – Matthew 2010-12-02 18:58:00