Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get the short and long date format string
Message
De
21/06/2007 13:32:27
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01234713
Message ID:
01234798
Vues:
11
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform