Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get the short and long date format string
Message
From
21/06/2007 13:32:27
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01234713
Message ID:
01234798
Views:
12
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all
>
>Is there a WinAPI which returns the string of long and short date formats? The date as defined in the regional settings.
>
>Please advise.

GetLocaleInfo:
http://msdn2.microsoft.com/en-us/library/ms776270.aspx

LCTYPE Constants (National Language Support)
http://msdn2.microsoft.com/en-us/library/bb507201.aspx



#Define LOCALE_SLONGDATE 0x20
#Define LOCALE_SSHORTDATE 0x1F
#Define LOCALE_USER_DEFAULT 0x400
#Define LOCALE_SYSTEM_DEFAULT 0x800

Declare Integer GetLocaleInfo In win32api ;
Integer Locale, ;
Integer LCType, ;
String lpLCData, ;
Integer cchData


m.lcLocaleInfo = Replicate(Chr(0), 255)
m.lnCharsRet = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, @m.lcLocaleInfo, Len(m.lcLocaleInfo))
m.lcLocaleInfo = Left(m.lcLocaleInfo, m.lnCharsRet -1) && remove ending chr(0)

?"LOCALE_USER_DEFAULT, LOCALE_SLONGDATE", m.lcLocaleInfo

m.lcLocaleInfo = Replicate(Chr(0), 255)
m.lnCharsRet = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, @m.lcLocaleInfo, Len(m.lcLocaleInfo))
m.lcLocaleInfo = Left(m.lcLocaleInfo, m.lnCharsRet -1) && remove ending chr(0)

?"LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE", m.lcLocaleInfo

m.lcLocaleInfo = Replicate(Chr(0), 255)
m.lnCharsRet = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SLONGDATE, @m.lcLocaleInfo, Len(m.lcLocaleInfo))
m.lcLocaleInfo = Left(m.lcLocaleInfo, m.lnCharsRet -1) && remove ending chr(0)

?"LOCALE_SYSTEM_DEFAULT, LOCALE_SLONGDATE", m.lcLocaleInfo

m.lcLocaleInfo = Replicate(Chr(0), 255)
m.lnCharsRet = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, @m.lcLocaleInfo, Len(m.lcLocaleInfo))
m.lcLocaleInfo = Left(m.lcLocaleInfo, m.lnCharsRet -1) && remove ending chr(0)

?"LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE", m.lcLocaleInfo



Carlos
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform