I have a form which submits dates from a Javascript pop up calendar to a submit form. These date are shown in the format dd/mm/yyyy which is what I want.
The problem comes when I try to pass them to a VBScript asp page. The dates if not valid US date will change to US dates (ie 1 Feb (01/02) is fime but 13 Feb (13/02) changes to 02/12).
I also have problems entering the dates into a sql string as they are not recognized as dates. The code I am using is:
dateFrom=Request.Form(“date1”)
dateTo=Request.Form(“date2″)
dateFrom = cdate(dateFrom)
dateTo = cdate(dateTo)
Response.Write DateFrom & ” ” & DateTo
If DateTo = “” Then
DateTo = Date
End If
If DateFrom = “” Then
DateFrom = Date -7
End If
‘Initialize the string
strSQL = “SELECT SearchDate, SearchString, SearchCriteria” _
& ” FROM SearchRecord” _
& ” WHERE (SearchDate BETWEEN CONVERT(DATETIME, ‘” & DateFrom & “‘, 102)” _
& ” AND CONVERT(DATETIME, ‘” & DateTo & “‘, 102))”
Response.Write ” ” & strSQL
Your help wpuld be most appreciated.