Option Explicit
Private Declare Function GetLocaleInfo Lib “kernel32” Alias “GetLocaleInfoA” (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Const LOCALE_USER_DEFAULT As Long = &H400
Private Const LOCALE_SSHORTDATE As Long = &H1F
Private Sub Form_Load()
Dim sDateFormat As String
Dim lRet As Long
sDateFormat = Space$(255)
lRet = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, sDateFormat, Len(sDateFormat))
If lRet > 0 Then
sDateFormat = Left$(sDateFormat, lRet – 1)
MsgBox “The short date format is: ” & sDateFormat
Else
MsgBox “Failed to retrieve the short date format.”
End If
End Sub