Format Date to dd/mm/yyyy

Posted on 2004-11-05
Last Modified: 2011-09-20

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_numRows = 0

Question by:jkharodia
    LVL 48

    Expert Comment

    by:Ryan Chong
    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?

    Accepted Solution

    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.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
    This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now