[AccessD] Determining Regional Date Setting

Erwin Craps - IT Helps Erwin.Craps at ithelps.be
Tue May 4 11:48:51 CDT 2004


I'm aware of the folowing.

Seperators
/ - . (dot is germany at my knowledge)

Order
dd mm yy
mm dd yy

Iso order
yyyy mm dd

My comment was intended on the alfa month name.
I know a ticket sales application (In MS Access) used in Germany and
Belgium that crashes if the computer is not set on English month names.
Somewher in the code is alfa month used and it crashes on German or
Dutch local settings for some months.

For example
English: Jan 	Feb 	Mar 	Apr 	May 	Jun 	Jul 	Aug
Sep 	Oct 	Nov 	Dec
Duth:    Jan  	Feb  	Mar 	Apr 	Mei 	Jun 	Jul 	Aug
Sep 	Oct 	Nov 	Dec
German:  Jan  	Feb  	Mrz  	Apr  	Mai  	Jun  	Jul  	Aug
Sep  	Okt  	Nov  	Dez

As you notice a lot of shorts are identical.
This ticket app, work fine until after a few months in Mai a (important)
report no longer worked and gave an error.
The cause of the error was that when building his SQL string he use the
mmm format to specify a date.
Ofcourse in English its is May but in Dutch it is Mei. So access gave a
runtime error.

So never use alfa shorts for months and never split a date based on a
fix seperator like "/" or "-".
You get in to trouble one day... And these are errors hard to find.

The reason why I know german use . As seperator is because a Belgian
Electronic Banking software fails  to work when the pc is set to German
(We are trilangual in Belgium). You can leave the pc set to German but
you need to change the regional settings date format seperator to / or
-.
I and the bank helpdesk searched for about 8 hours to solve this....


There is another oddity I Access when using dates...
I believe its a bug since Access 2K.

Try this (you all know that u can simulate a american date with #[Date]#
? cdate(#1/12/2004#)-1 this results in 11/01/2004 beeing 1 january 2004
? cdate(#31/12/2004#)-1 this results in 30/12/2004 beeing 30 december
2004
? cdate(#12/31/2004#)-1 this also results in 30/12/2004 beeing 30
december 2004
Bizare he?
Never trust Access with dates.....

I supose this bug is only in the international versions...




Erwin










 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
- Beach Access Software
Sent: Tuesday, May 04, 2004 4:32 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Determining Regional Date Setting

Erwin:

What other short date formats might you expect to see besides mm/dd/yy
and dd/mm/yy?

Rocky

----- Original Message -----
From: "Erwin Craps - IT Helps" <Erwin.Craps at ithelps.be>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Monday, May 03, 2004 1:04 PM
Subject: RE: [AccessD] Determining Regional Date Setting


> No...
> >>"One simple way would be to compare Datevalue("1/6/04") to
> >>Datevalue("6 Jan 04") and Datevalue("1 Jun 04")"
>
> The short for months can be different in other languages and your code
> will fail if a local language windows is used.
> Please find code example which should put you on the road.
> The API GetDateFormat is the way to go. It pretty simple.
> For total Api list visit the mentioned website to download the free
API
> guide = good.
>
> Erwin
>
>
> Option Compare Database
> Private Type SYSTEMTIME
>         wYear As Integer
>         wMonth As Integer
>         wDayOfWeek As Integer
>         wDay As Integer
>         wHour As Integer
>         wMinute As Integer
>         wSecond As Integer
>         wMilliseconds As Integer
> End Type
> Private Declare Function GetDateFormat Lib "kernel32" Alias
> "GetDateFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, lpDate
As
> SYSTEMTIME, ByVal lpFormat As String, ByVal lpDateStr As String, ByVal
> cchDate As Long) As Long
> Public Sub testtt()
>     'KPD-Team 2000
>     'URL: http://www.allapi.net/
>     'E-Mail: KPDTeam at Allapi.net
>     Dim Buffer As String, ST As SYSTEMTIME
>     With ST
>         .wDay = 31
>         .wMonth = 8
>         .wYear = 2000
>     End With
>     Buffer = String(255, 0)
>     GetDateFormat ByVal 0&, 0, ST, vbNullString, Buffer, Len(Buffer)
>     Buffer = Left$(Buffer, InStr(1, Buffer, Chr$(0)) - 1)
>     MsgBox Buffer
> End Sub
>
>
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
> McLachlan
> Sent: Sunday, May 02, 2004 11:24 PM
> To: Access Developers discussion and problemsolving
> Subject: Re: [AccessD] Determining Regional Date Setting
>
> On 2 May 2004 at 11:38, Rocky Smolin - Beach Access S wrote:
>
> > Dear list:
> >
> > Is there an easy way to determine if Windows is set to that 'other'
> date format (dd/mm/yy)?
> >
> That's only one of a large number of possible alternatives.
>
> Why do you want to know. Depending on that, there are a number of
tricks
> you can use.
>
> One simple way would be to compare Datevalue("1/6/04") to
> Datevalue("6 Jan 04") and Datevalue("1 Jun 04") and see which matches.
>
> A more complicated, but also more versatile  way is to use a call to
the
> GetDateFormat() API and see exactly what regional format is in use.
>
>
>
>
>
> -- 
> Lexacorp Ltd
> http://www.lexacorp.com.pg
> Information Technology Consultancy, Software Development,System
> Support.
>
>
>
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list