| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with date format
I have a Access DB where I select data via "DateFrom" and "DateTo" fields and the passed onto a result page.
Dates are entered as dd/mm/yyyy. and selected with the same format. It does not retrieve the data correctly - totally ignoring the "DateFrom" parameter. If - however - I select date entering the format mm/dd/yyyy it works perfectly - execept for the fact that I have the "wrong" formatting in the resuklts page. Here is the code on the result page. <% Dim rsSearchVal__sFromDate rsSearchVal__sFromDate = "01/01/2004" If (Request.Form("FromDate") <> "") Then rsSearchVal__sFromDate = Request.Form("FromDate") End If %> <% Dim rsSearchVal__sToDate rsSearchVal__sToDate = "31/12/2020" If (Request.Form("ToDate") <> "") Then rsSearchVal__sToDate = Request.Form("ToDate") End If %> <% Dim rsSearchVal__sDest rsSearchVal__sDest = "1" If (request.Form("Dest") <> "") Then rsSearchVal__sDest = request.Form("Dest") End If %> <% Dim rsSearchVal Dim rsSearchVal_numRows Set rsSearchVal = Server.CreateObject("ADODB.Recordset") rsSearchVal.ActiveConnection = MM_IntranetDB_STRING rsSearchVal.Source = "SELECT * FROM Richemont WHERE DateDep BETWEEN #" + Replace(rsSearchVal__sFromDate, "'", "''") + "# AND #" + Replace(rsSearchVal__sToDate, "'", "''") + "# and Dest LIKE '" + Replace(rsSearchVal__sDest, "'", "''") + "' ORDER BY DateDep ASC" rsSearchVal.CursorType = 0 rsSearchVal.CursorLocation = 2 rsSearchVal.LockType = 1 rsSearchVal.Open() rsSearchVal_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 rsSearchVal_numRows = rsSearchVal_numRows + Repeat1__numRows %> Your help is appreciated. Ed |
|
#2
|
||||
|
||||
|
VBScript has a FormatDateTime Function.
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Help with date format |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|