Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dynamic List Formatting

Engaged ,
Mar 19, 2007 Mar 19, 2007
I have a list of around 1800 dates (some are duplicates) stored in an access query. I want to include them in a dynamic list in date order in the format day month year. - "17/01/2000" without duplicates - hence the DISTINCT in the recordset below:

<%
var recordset2_cmd = Server.CreateObject ("ADODB.Command");
recordset2_cmd.ActiveConnection = MM_SEEALL_STRING;
recordset2_cmd.CommandText = "SELECT DISTINCT photodate FROM Dates ORDER BY photodate DESC";
recordset2_cmd.Prepared = true;

var recordset2 = recordset2_cmd.Execute();
var recordset2_numRows = 0;
%>
With the following selection code:

<select name="select" size="20" title="<%= DoDateTime((recordset2.Fields.Item("photodate").Value), 2, 2057) %>">
<%
while (!recordset2.EOF) {
%><option value="<%=(recordset2.Fields.Item("photodate").Value)%>" <%=((recordset2.Fields.Item("photodate").Value == (recordset2.Fields.Item("photodate").Value))?"selected=\"selected\"":"")%> ><%=(recordset2.Fields.Item("photodate").Value)%></option>
<%
recordset2.MoveNext();
}
if (recordset2.CursorType > 0) {
if (!recordset2.BOF) recordset2.MoveFirst();
} else {
recordset2.Requery();
}
%>
</select>
When run (on my testing server) the dates (correctly ordered and distinct) are all shown in the form "1/17/2000" instead of 17/01/2000.

Can anyone tell me why?

Howard Walker
TOPICS
Server side applications
298
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 19, 2007 Mar 19, 2007
On 19 Mar 2007 in macromedia.dreamweaver.appdev, whatalotofrubbish
wrote:

> When run (on my testing server) the dates (correctly ordered and
> distinct) are all shown in the form "1/17/2000" instead of
> 17/01/2000.
>
> Can anyone tell me why?

Because Microsoft products, by default, assume you're in the US?

You need to set a Location ID (LCID) (2057 for UK, which should give you
the date formatting you want):

<% @LANGUAGE=VBSCRIPT %>
<% Session.LCID = 2057 %>

--
Joe Makowiec
http://makowiec.net/...
Translate
LEGEND ,
Mar 19, 2007 Mar 19, 2007
On 19 Mar 2007 in macromedia.dreamweaver.appdev, whatalotofrubbish
wrote:

> When run (on my testing server) the dates (correctly ordered and
> distinct) are all shown in the form "1/17/2000" instead of
> 17/01/2000.
>
> Can anyone tell me why?

Because Microsoft products, by default, assume you're in the US?

You need to set a Location ID (LCID) (2057 for UK, which should give you
the date formatting you want):

<% @LANGUAGE=VBSCRIPT %>
<% Session.LCID = 2057 %>

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 20, 2007 Mar 20, 2007
Thanks for the hint, but I tried it with no success.
If you look at my code on the first posting, there is a line
<select name="select" size="20" title="<%= DoDateTime((recordset2.Fields.Item("photodate").Value), 2, 2057) %>">
I thought that the LCID code was inserted there. This code is what Dreamweaver generates when I set the format from the bindings/format panel.

The dates all display properly in my access database, and also when appled to a single date item on the page. The only place that they do not display properly is in the drop down list.
Any further help would be appreciated.


Howard
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 21, 2007 Mar 21, 2007
LATEST
Tried it again, placing the code on the first line of the page and it now works fine.
Many thanks.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines