在VB.net中,在VS2003中工作的日期字符串+“ - 23.59.59.999”不在VS2008或VS2010中

时间:2013-02-06 07:34:47

标签: asp.net vb.net visual-studio iis code-behind

Hi All The Below代码在Visual Studio 2003中运行正常但在我将解决方案转换为VS2008之后,下面给出了错误。请帮我解决问题

代码:

Dim strToDate As string
strToDate = "2013-02-06"

Dim dateFromSelect, dateToSelect, dateToSelectEnd, dateFromSelectStart As DateTime

dateToSelectEnd = strToDate + "-23:59:59.9999999"

错误

Conversion from string "2013-02-06-23:59:59.9999999" to type 'Date' is not valid

1 个答案:

答案 0 :(得分:1)

问题是

dateToSelectEnd = strToDate + "-23:59:59.9999999"

应该是

dateToSelectEnd = strToDate + " 23:59:59.9999999"