Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error 2034 when entering a Date below 1601-01-01
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01053305
Message ID:
01053824
Views:
6
Here is my Code to get the correct Date Format into the System :
*Marvin Blase : Determine which FOXPRO DATE Format is used because of VFP8 Bug

#define LOCALE_SSHORTDATE           0x001F    &&short date-time separator 
#define LOCALE_IDATE                0x0021    &&short date format ordering 

DECLARE SHORT	GetUserDefaultLCID	IN kernel32
DECLARE INTEGER GetLocaleInfo		IN kernel32 INTEGER  Locale,INTEGER  LCType,STRING @ lpLCData,INTEGER cchData

LOCAL lcBuffer, lcShortdateFormat,lcFoxDateFormat,lnLocale_dateformat,lnLocale
lcFoxDateFormat		= ""
lcBuffer			= SPACE(255)
lnLocale			= GetUserDefaultLCID()
GetLocaleInfo(lnLocale,LOCALE_SSHORTDATE, @lcBuffer,LEN(lcBuffer))
lcShortdateFormat	= UPPER(LEFT(lcBuffer,AT(CHR(0),lcBuffer)-1))
lcShortdateFormat	= STRTRAN(lcShortdateFormat,"YYYY","YY")
DO CASE
CASE lcShortdateFormat="MM/DD/YY" &&AMERICAN mm/tt/jj 
	lcFoxDateFormat = "AMERICAN"
CASE lcShortdateFormat="YY.MM.DD" &&ANSI jj.mm.tt 
	lcFoxDateFormat	= "ANSI"
CASE lcShortdateFormat="DD/MM/YY" &&BRITISH/FRENCH tt/mm/jj
	lcFoxDateFormat = "BRITISH"
CASE lcShortdateFormat="DD.MM.YY" &&GERMAN tt.mm.jj 
	lcFoxDateFormat	= "GERMAN"
CASE lcShortdateFormat="DD-MM-YY" &&ITALIAN tt-mm-jj
	lcFoxDateFormat	= "ITALIAN"
CASE lcShortdateFormat="YY/MM/DD" &&JAPAN jj/mm/tt
	lcFoxDateFormat	= "JAPAN"
CASE lcShortdateFormat="MM-DD-YY" &&USA mm-tt-jj 
	lcFoxDateFormat	= "USA"
OTHERWISE
	*!*	MDY mm/tt/jj 
	*!*	DMY tt/mm/jj 
	*!*	YMD jj/mm/tt 
	lcBuffer			= SPACE(255)
	GetLocaleInfo(lnLocale,LOCALE_IDATE, @lcBuffer,LEN(lcBuffer))
	lnLocale_dateformat = VAL(LEFT(lcBuffer,AT(CHR(0),lcBuffer)-1))
	DO case
	    CASE lnLocale_dateformat = 0
	        lcFoxDateFormat = "MDY"
	    CASE lnLocale_dateformat = 1
	        lcFoxDateFormat = "DMY"
	    CASE lnLocale_dateformat = 2
	        lcFoxDateFormat = "YMD"
	ENDCASE
ENDCASE
RETURN lcFoxDateFormat
Marvin Blase (tA-logistic Software GmbH)
You'll never notice the good things if you haven't seen the bad.
Previous
Reply
Map
View

Click here to load this message in the networking platform