Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Date search switches dd and mm?

Posted 16 Apr 2002 02:07:32
1
has voted
16 Apr 2002 02:07:32 Garo Maka posted:
Hi, making an event calender. The date format is danish (1030) and it shows same display in resultspage and database, that is dd-mm-yyyy.

But when I search it switches dd and mm. That is, to get the right results from 1-April-2002 to 30-April-2002 I would have to type. FromField: 4-1-2002 ToField: 4-30-2002.

Anyone know how you can search in same format as the format displayed in database?
Thanks

Replies

Replied 16 Apr 2002 10:47:03
16 Apr 2002 10:47:03 Marcellino Bommezijn replied:
Do all pages have the LCID (1030) ?

Taken from MSDN website:
------------------------------
The LCID property specifies how dates, times, and currencies are formatted. LCIDs are not the same for each geographical locale.
Some locales format dates as YY-MM-DD and some format dates as MM-DD-YYYY.

Use this ASP code to return the correct format for your Geographical location.


Session.LCID(= LocaleID)
-----------------------------

Link for all codes available:

msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsmscLCID.asp


Replied 16 Apr 2002 13:41:27
16 Apr 2002 13:41:27 Garo Maka replied:
Yes, the pages involved have the <%@LANGUAGE="VBSCRIPT" LCID=1030%>, the search funktion is in an include, but the <%@LANGUAGE="VBSCRIPT" LCID=1030%> in the results page should work for it as well.

I have tryed at the external server aswell its the same problem. In database and resultspage is displaid as dd-mm-yyyy but it searches for mm-dd-yyyy.

Replied 16 Apr 2002 13:57:40
16 Apr 2002 13:57:40 Garo Maka replied:
I guess the problem must be in the recordset, the date format it must search for must also be defined her.
But how? Here is the code:

<%
varWhereString = "WHERE Event_ID <> -1 " ' This will return all phone numbers if all the text fields are left blank

IF Request("txtFromDate" <>"" Then
AndFromDateString = " AND Start_Date >= #" & Request("txtFromDate" & "#"
Else
AndFromDateString = ""
End If

IF Request("txtToDate" <>"" Then
AndToDateString = " AND End_Date <= #" & Request("txtToDate" & "#"
Else
AndToDateString = ""
End If

IF Request("selAmt" <>"" Then
AndAmtString = " AND Amt LIKE '%" & Request("selAmt" & "%'"
Else
AndAmtString = ""
End If

varWhereString = varWhereString & AndFromDateString & AndToDateString & AndAmtString & " ORDER BY Start_Date ASC"
%>
<%
set rsDate = Server.CreateObject("ADODB.Recordset"
rsDate.ActiveConnection = MM_connDezzPortal_STRING
rsDate.Source = "SELECT * FROM tblEvents " &varWhereString
rsDate.CursorType = 0
rsDate.CursorLocation = 2
rsDate.LockType = 3
rsDate.Open()
rsDate_numRows = 0
%>

If you know how to define the date format that it must filter through, please give me a hand.

Reply to this topic