【发布时间】:2014-03-07 08:31:55
【问题描述】:
我正在从 SQL 数据库中获取数据,现在我正在尝试将数据转换为 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() 在类似的帖子 [这里][1] [1]:stackoverflow.com/questions/2794305/…
标签: sql .net vb.net parsing date