Search code examples
asp.netvb.netvisual-studioiiscode-behind

In VB.net datestring + "-23.59.59.999" working in VS2003 not in VS2008 or VS2010


Hi All The Below code is working fine in Visual Studio 2003 but after i converted the solution to VS2008 the Below is giving error. Please Help me to fix the issue

code:

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

Dim dateFromSelect, dateToSelect, dateToSelectEnd, dateFromSelectStart As DateTime

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

Error

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

Solution

  • the problem is

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

    it should be

    dateToSelectEnd = strToDate + " 23:59:59.9999999"