Date comes out wrong in England

A

albert.repasky

Some of the users that will be using my program are in London. When
they run my reports the dates come out in European format d/m/y. Also,
I think that the reports come out wrong by putting information in the
wrong place (month) on the reports. In London their version of Access
is 2000, and I am using 2000 file formats in my 2003 version when
developing. When she sends me back a copy of the program and I run it
here in the US, things come out in the correct format and correct
month.

I do not know what is wrong. Is there a European version of Access?
 
A

albert.repasky

See:
    International Date Formats in Access
at:
   http://allenbrowne.com/ser-36.html

The article is based on years of using Access in Australia, which uses the
same dmy dates as UK.

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.







- Show quoted text -

I am storing the Month and Year. It is a long story, but I have
information that comes in for head count information. It is imported
as a spreadsheet. It has 54 months of info. So I write a records out
for each of the 54 months by knowing which month is in which position
on the speadsheet. Otherwise I can not use the data. Then the user
adds requisitions, but sometimes they are early so I change the month
the same way. I write out the data as the first day of the month.
This way when sorting, etc. it will be put in the correct month.

But we also have people in the UK that are going to use the program.
So a date 6/1/2008 is changed to 1/6/2008. I changed the regional
setting and that is what is happening.

The code that does this for both the imported info and the requisition
data is:

MyT![fldMonthYear] = CDate(CStr(M2) + "/01/" + CStr(Y2))

It works great for the USA.

The report print out heading as APR08 (format MMMYY), but in the UK it
changes everything to JAN08. That is besides having the req dates
wrong also.

The program is 99% done except for this.

Is there a way I could set their regional setting to the USA on the
fly or check what setting the windows is using?

Thanks,
Arep








MyT![fldMonthYear] = CDate(CStr(M2) + "/01/" + CStr(Y2))
 
J

John Spencer

Try using the DateSerial function to generate the date. Your method (as you
have found out) will give different results depending on the settings in
various countries.

MyT![fldMonthYear] = DateSerial(Y2,M2,1)


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

See:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html

The article is based on years of using Access in Australia, which uses the
same dmy dates as UK.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.





- Show quoted text -

I am storing the Month and Year. It is a long story, but I have
information that comes in for head count information. It is imported
as a spreadsheet. It has 54 months of info. So I write a records out
for each of the 54 months by knowing which month is in which position
on the speadsheet. Otherwise I can not use the data. Then the user
adds requisitions, but sometimes they are early so I change the month
the same way. I write out the data as the first day of the month.
This way when sorting, etc. it will be put in the correct month.

But we also have people in the UK that are going to use the program.
So a date 6/1/2008 is changed to 1/6/2008. I changed the regional
setting and that is what is happening.

The code that does this for both the imported info and the requisition
data is:

MyT![fldMonthYear] = CDate(CStr(M2) + "/01/" + CStr(Y2))

It works great for the USA.

The report print out heading as APR08 (format MMMYY), but in the UK it
changes everything to JAN08. That is besides having the req dates
wrong also.

The program is 99% done except for this.

Is there a way I could set their regional setting to the USA on the
fly or check what setting the windows is using?

Thanks,
Arep








MyT![fldMonthYear] = CDate(CStr(M2) + "/01/" + CStr(Y2))
 
A

albert.repasky

Try using the DateSerial function to generate the date.  Your method (asyou
have found out) will give different results depending on the settings in
various countries.

MyT![fldMonthYear] = DateSerial(Y2,M2,1)

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County



I am storing the Month and Year.  It is a long story, but I have
information that comes in for head count information.  It is imported
as a spreadsheet.  It has 54 months of info.  So I write a records out
for each of the 54 months by knowing which month is in which position
on the speadsheet.  Otherwise I can not use the data.  Then the user
adds requisitions, but sometimes they are early so I change the month
the same way.  I write out the data as the first day of the month.
This way when sorting, etc. it will be put in the correct month.
But we also have people in the UK that are going to use the program.
So a date 6/1/2008 is changed to 1/6/2008.  I changed the regional
setting and that is what is happening.
The code that does this for both the imported info and the requisition
data is:
MyT![fldMonthYear] = CDate(CStr(M2) + "/01/" + CStr(Y2))
It works great for the USA.
The report print out heading as APR08 (format MMMYY), but in the UK it
changes everything to JAN08.  That is besides having the req dates
wrong also.
The program is 99% done except for this.
Is there a way I could set their regional setting to the USA on the
fly or check what setting the windows is using?
Thanks,
Arep

MyT![fldMonthYear] = CDate(CStr(M2) + "/01/" + CStr(Y2))- Hide quoted text -

- Show quoted text -

John,

That DateSerial function solved the problem. Thanks so much. Without
that solution I do not know what I would have done.

Arep
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top