I had it figured out some time back but don't remember now. Although as far as I am remember, my method was not full proof and there was no way to tell a date format on days like 1st Jan, 2nd Feb, 3rd Mar, etc.
But still just give me a day or two and I will try to find it out.
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 Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
Private Const LOCALE_SSHORTDATE = &H1F
Private Sub Command1_Click()
Dim strResult As String
Dim strInfo As String * 10
lngIdentifier = GetUserDefaultLCID()
lngResult = GetLocaleInfo(lngIdentifier, LOCALE_SSHORTDATE, strInfo, 10)
strResult = "Short Date String = " & strInfo & vbLf
MsgBox Replace(strResult, Chr(0), "")
End Sub
If Month("01-02-03") = 1 Then
strFormat ="MM/DD/yyyy"
else Month("01-02-03") = 2 Then
strFormat = "DD/MM/yyyy"
End if
Status
Not open for further replies.
You have insufficient privileges to reply here.
Related Threads
?
?
?
?
?
Tech Support Guy
9.9M posts
859.7K members
Since 1998
A forum community dedicated to tech experts and enthusiasts. Come join the discussion about articles, computer security, Mac, Microsoft, Linux, hardware, networking, gaming, reviews, accessories, and more!