Rocky Smolin - Beach Access Software
bchacc at san.rr.com
Tue May 4 09:31:50 CDT 2004
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