Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UK Dates and ASP

Status
Not open for further replies.

fatstu

Technical User
Feb 22, 2002
20
US
Im developing a small ASP/Access 2000 driven tool at the moment. I want to pass a date from page1.asp as a URL Parameter to page2.asp. Page2.asp then filters the data which equals the date from the URL Parameter....simple stuff. But no!! In dreamweaver MX when I test the data with a UK date it is fine, it pulls up all the data refined by the date. However, when run it via the web server the UK data is taken and passed in the URL in UK style but on page2.asp it thinks its a US date. The server is on UK settings. Ive tried putting inverted commas round the date in the SQL used in page2.asp and also hashes...neither of which work. Please help!! Where does IIS get its date format from? can it be changed? Is this even the problem?
 
I'm not sure whether this will help or not... try putting:

<% Session.LCID = 2057 %>

at the top of your asp pages.

It sets all the date / time to uk format.

Mark
 
Thanks Mark, added that bit in but its still pulling records back in american format. Heres the code im using, any help would be very much appreciated.


<!--#include file=&quot;Connections/Exceptions.asp&quot; -->
<% Session.LCID = 2057 %>
<%
Dim Recordset1__appdate_sql
Recordset1__appdate_sql = &quot;01/01/02&quot;
If (Request.QueryString(&quot;appdate&quot;) <> &quot;&quot;) Then
Recordset1__appdate_sql = Request.QueryString(&quot;appdate&quot;)
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset1.ActiveConnection = MM_Exceptions_STRING
Recordset1.Source = &quot;SELECT * FROM qry_excp2_asp_data WHERE Exception_ID = Exception_Trace AND Start_Date = #&quot; + Replace(Recordset1__appdate_sql, &quot;'&quot;, &quot;''&quot;) + &quot;# ORDER BY postedfor ASC&quot;
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<html>
<head>
<title>WPA</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<link href=&quot;style1.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
</head>

<body>
<%=(Recordset1.Fields.Item(&quot;Start_Date&quot;).Value)%><br>
 
I had similar problems using SQL server. I think this will work for Access too. When inserting dates in SQL stings use yyyy-mm-dd format which is seems to be universal and not locale dependant. I use the following function in ASP:

Function SQLDate(Indate)
SQLDate = Year(InDate) & &quot;-&quot; & Month(Indate) & &quot;-&quot; & Day(InDate)

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top