Question Error reading : "date format picture ends before converting entire input string"

Joined
Oct 9, 2009
Messages
14
Programming Experience
Beginner
Error reading : "date format picture ends before converting entire input string"

OK, so I am connecting to an ODBC, and parsing the data before it comes in. The Code works when I have just a date, but when I try to add a time I get an error. I guess the problem is that the ODBC requires a specific format for time, but I don't know what it is. How do you recommend I solve this? Thank you for your input.

On a side note, I am retrieving the date and time from two separate date time pickers and then combining them into the string; Fixed_startdate.



CODE:


Public StartDate As String
Public StartTime As String
Public EndDate As String
Public EndTime As String
Dim fixed_startdate As String
Dim fixed_enddate As String


'formatting the date
fixed_startdate = String.Format(StartDate, "dd-MMM-yyyy") & " " & String.Format(StartTime, "HH:mm:ss")

'creating the SQL string
SQL = String.Format("select........................... WHERE DATE_RECORDED>= '" & fixed_startdate & "' And DATE_RECORDED<='" & fixed_enddate & "')
 
By the way I have tried this code and it also gave the same error.

WHERE DATE_RECORDED>=TO_DATE('" & fixed_startdate & "') And DATE_RECORDED<=TO_DATE('" & fixed_enddate & "')
 
Back
Top