PDA

View Full Version : MSACCESS months and day swapped


prae
10-14-2004, 05:15 AM
Hi Guys,

We have a website database (msaccess) with dates of format DD/MM/YYYY

When we enter 14/08/2004, it works
When we enter 07/08/2004, it actually enters 08/07/2004 in the database.

We don't have this problem locally here, on our development plateform.

Our regional settings are set to English (Australia).
In the MSACCESS table definition, we set the format dd/mm/yyyy

It works really well here, but months and days are swapped on your server when we enter a day <= 12.

Any idea, we're lost !

Thank you,

Philippe

prae
10-14-2004, 10:49 AM
ASP

bruce
10-14-2004, 11:05 AM
Are you using ASP.net or ASP?

[b]quote:Originally posted by prae

Hi Guys,

We have a website database (msaccess) with dates of format DD/MM/YYYY

When we enter 14/08/2004, it works
When we enter 07/08/2004, it actually enters 08/07/2004 in the database.

We don't have this problem locally here, on our development plateform.

Our regional settings are set to English (Australia).
In the MSACCESS table definition, we set the format dd/mm/yyyy

It works really well here, but months and days are swapped on your server when we enter a day <= 12.

Any idea, we're lost !

Thank you,

Philippe


</blockquote id="quote"></font id="quote">

B.

DiscountASP.NET
http://www.DiscountASP.NET

bruce
10-15-2004, 11:43 AM
Well... I don't think ASP has the locale setting like ASP.net.

You may need to format the date before inserting to the database.

FormattedDate = Format(Now,"MM/dd/yyyy")

[b]quote:Originally posted by prae

ASP
</blockquote id="quote"></font id="quote">

B.

DiscountASP.NET
http://www.DiscountASP.NET

daveyjohn
10-21-2004, 09:17 AM
prae said...
Hi Guys,

We have a website database (msaccess) with dates of format DD/MM/YYYY

When we enter 14/08/2004, it works
When we enter 07/08/2004, it actually enters 08/07/2004 in the database.

We don't have this problem locally here, on our development plateform.

Our regional settings are set to English (Australia).
In the MSACCESS table definition, we set the format dd/mm/yyyy

It works really well here, but months and days are swapped on your server when we enter a day <= 12.



You can set the server locale on each individual page. This is the code I use to set it to English (UK) for example:

[quote]
<%
session.LCID=2057
%>
</CODE>

There's a full list of LCID codes at:

msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsmsclcid.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsmsclcid.asp)

The English (Australia) code is 3081.

Just add that one line of code to the top of each page that uses dates and then you don't need to reformat the date before sending it to the database. Your existing code will work fine.

I used to reformat the date every time for years. It drove me mad.