Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Win95's date format
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00141865
Message ID:
00141891
Views:
13
>Is there an API function that returns the Windows date format (short date style, long date style).
>

Hi Marios,

Here's the code you'll need with some useful defined values:
#define LOCALE_SDATE                  0x0000001D   && date separator
#define LOCALE_STIME                  0x0000001E   && time separator
#define LOCALE_SSHORTDATE             0x0000001F   && short date format string
#define LOCALE_SLONGDATE              0x00000020   && long date format string
#define LOCALE_STIMEFORMAT            0x00001003   && time format string
#define LOCALE_IDATE                  0x00000021   && short date format ordering
#define LOCALE_ILDATE                 0x00000022   && long date format ordering
#define LOCALE_ITIME                  0x00000023   && time format specifier
#define LOCALE_ITIMEMARKPOSN          0x00001005   && time marker position
#define LOCALE_ICENTURY               0x00000024   && century format specifier (short date)
#define LOCALE_ITLZERO                0x00000025   && leading zeros in time field
#define LOCALE_IDAYLZERO              0x00000026   && leading zeros in day field (short date)
#define LOCALE_IMONLZERO              0x00000027   && leading zeros in month field (short date)
#define LOCALE_S1159                  0x00000028   && AM designator
#define LOCALE_S2359                  0x00000029   && PM designator

#define LOCALE_ICALENDARTYPE          0x00001009   && type of calendar specifier
#define LOCALE_IOPTIONALCALENDAR      0x0000100B   && additional calendar types specifier
#define LOCALE_IFIRSTDAYOFWEEK        0x0000100C   && first day of week specifier
#define LOCALE_IFIRSTWEEKOFYEAR       0x0000100D   && first week of year specifier


DECLARE INTEGER GetSystemDefaultLCID IN Win32API
DECLARE INTEGER GetLocaleInfo IN Win32API;
  INTEGER Locale, INTEGER LCType,;
  STRING @lpLCData, INTEGER cchData
lnLCID = GetSystemDefaultLCID()
lcbuffer = SPACE(260)
lnbuflen = LEN(lcbuffer)
lnresult = GetLocaleInfo(lnLCID, LOCALE_STIME, @lcbuffer, lnbuflen)
? LEFT(lcbuffer, lnresult - 1)
hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform