[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Format Date to dd/mm/yyyy

Hi

I am using Dreamweaver to create a recordet which retrieves data from an Access Database, the problem I am having is that the when the use enters the date in dd/mm/yyyy format no records are retrieved, it works fine when you use the American or the international format.  The Access database stores the date in dd/mm/yyyy format.

Below is the code Dreamweaver has generated, how i can format the date so it used the UK format.

<% Session.LCID = 2057 %> <!--UK regional settings -->
<%
Dim rsDetails__paramStartDt
rsDetails__paramStartDt = "01/10/2004"
If (request.form("txtStartDate")  <> "") Then
  rsDetails__paramStartDt = request.form("txtStartDate")
End If
%>
<%
Dim rsDetails
Dim rsDetails_numRows

Set rsDetails = Server.CreateObject("ADODB.Recordset")
rsDetails.ActiveConnection = MM_connCallScoring_STRING
rsDetails.Source = "select * from qryReturnOnWeb where DateCallTaken = #" + Replace(rsDetails__paramStartDt, "'", "''") + "#"
rsDetails.CursorType = 0
rsDetails.CursorLocation = 2
rsDetails.LockType = 1
rsDetails.Open()

rsDetails_numRows = 0
%>

PLEASE HELP
0
jkharodia
Asked:
jkharodia
1 Solution
 
Ryan ChongCommented:
when do querying, try format your date into mm/dd/yyy format? like:

...
'User enter date in format dd/mm/yyyy

If (request.form("txtStartDate")  <> "") Then
  rsDetails__paramStartDt = request.form("txtStartDate")
End If
...

'Get date in mm/dd/yyyy format

...
mydate = mid(rsDetails__paramStartDt, 4,2) & "/" & left(rsDetails__paramStartDt, 2) & "/" & Right(rsDetails__paramStartDt, 4)
...

and then try:

...
rsDetails.Source = "select * from qryReturnOnWeb where DateCallTaken = #" + Replace(mydate , "'", "''") + "#"
...

Is this Works?
0
 
Ellis_JuanCommented:
Not completely sure I understand the question. But one option may be this: There are some free dreamweaver server behaviors you can download from the dreamweaver exchange that will allow you to do some advanced form validation that will require the user to enter a date in whichever format you specify.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now