Is there any VBA function that lets me check a PC date format (regional setting). This is set within the Control Panel -> Region and Language.
Michael
Is there any VBA function that lets me check a PC date format (regional setting). This is set within the Control Panel -> Region and Language.
Michael
I found this a couple of years back which I use to check the regional date format:
Function DateFormat() As String
DateFormat = CStr(DateSerial(1999, 1, 2))
DateFormat = Replace(DateFormat, "1999", "YYYY")
DateFormat = Replace(DateFormat, "99", "YY")
DateFormat = Replace(DateFormat, "01", "MM")
DateFormat = Replace(DateFormat, "1", "M")
DateFormat = Replace(DateFormat, "02", "dd")
DateFormat = Replace(DateFormat, "2", "d")
DateFormat = Replace(DateFormat, MonthName(1), "MMMM")
DateFormat = Replace(DateFormat, MonthName(1, True), "MMM")
End Function
So on my set-up here, the function returns: dd/MM/YYYY
You can read this data from the registry at
HKEY_CURRENT_USER\Control Panel\Internationaly\
sLongDate
represents the long date e.g. dddd, d. MMMM yyyy
sShortDate
represents the short date e.g. yyyy-MM-dd