我從SQL數據庫中獲取數據,現在我試圖將數據轉換爲VB.NET中的適當日期變量,但我沒有得到適當的格式。從數據庫來自數據庫的日期格式在vb.net中獲取錯誤的日期
數據:
28-FEB-14 01:00:00:0
28-FEB-14 13:00:00:0
試圖將其轉換時,我得到的日期:
2028-02-14
2028-02-14 12:00:00
在執行該轉換的代碼:
Dim theDate As DateTime
Dim try1 As Date
For i As Integer = 0 To batchCount - 1
If Date.TryParse(dv(i)(0), theDate) = True Then
try1 = theDate.ToUniversalTime()
End If
將不勝感激所有的幫助,我可以得到。
嘗試Date.ParseExact() 有在Si上戰利品milar信息[這裏] [1] [1]:http://stackoverflow.com/questions/2794305/how-to-tryparse-a-single-string-to-datetime-in-dd- mm-yyyy-format-vb-net – userDee