Determining Regional Settings from Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I determine regional settings, whether it is set to US Date Settings
or otherwise, from MS Access?
 
Simplest way would be to use something like:


Dim strCheck As String

strCheck = Format(DateSerial(2003, 02, 01), "Short Date")
If Left(strCheck, 1) = "2" Then
' It's in m/d/yy[yy] format
ElseIf Left(strCheck, 2) = "02" Then
' It's in mm/dd/yy[yy] format
ElseIf Left(strCheck, 1) = "1" Then
' It's in d/m/yy[yy] format
ElseIf Left(strCheck, 2) = "01" Then
' It's in dd/mm/yy[yy] format
Else
' do additional checking
End If
 
Thanks for your help.

Douglas J. Steele said:
Simplest way would be to use something like:


Dim strCheck As String

strCheck = Format(DateSerial(2003, 02, 01), "Short Date")
If Left(strCheck, 1) = "2" Then
' It's in m/d/yy[yy] format
ElseIf Left(strCheck, 2) = "02" Then
' It's in mm/dd/yy[yy] format
ElseIf Left(strCheck, 1) = "1" Then
' It's in d/m/yy[yy] format
ElseIf Left(strCheck, 2) = "01" Then
' It's in dd/mm/yy[yy] format
Else
' do additional checking
End If


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Charles Tam said:
How do I determine regional settings, whether it is set to US Date Settings
or otherwise, from MS Access?
 
Back
Top