Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CDOW Problem
Message
 
To
09/07/2003 01:53:19
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00808318
Message ID:
00808340
Views:
12
This message has been marked as the solution to the initial question of the thread.
Agnes,

May be these functions to return local weekday and month names (two versions for each function) could help you:
For i = 1 to 12
? LocalMonthName1(i, .T.), LocalMonthName2(i)
EndFor

For i = 1 to 7
? LocalWeekdayName1(i, .T.), LocalWeekdayName2(i)
EndFor

Function LocalMonthName1(tnMonth, tlAbbrev)
If (VarType(tnMonth) != 'N') Or (tnMonth < 1) Or (tnMonth > 12) Or (VarType(tlAbbrev) != 'L')
	Error 11
EndIf

Local buf, n
Declare Long GetLocaleInfo In Win32API ;
	Long Locale, Long LCType, String @ lpLCData, Long cchData
buf = Replicate(Chr(0), 16)
n = GetLocaleInfo(0, IIf(tlAbbrev, 0x43, 0x37) + tnMonth, @buf, 16)
Return Left(buf, n - 1)

Function LocalMonthName2(tnMonth, tlAbbrev)
If (VarType(tnMonth) != 'N') Or (tnMonth < 1) Or (tnMonth > 12) Or (VarType(tlAbbrev) != 'L')
	Error 11
EndIf

Local bstr, buf, n
Declare Long VarMonthName In Oleaut32.dll ;
	Long iMonth, Long fAbbrev, Long dwFlags, Long @ pbstrOut
Declare Long WideCharToMultiByte In Win32API ;
	Long CodePage, Long dwFlags, Long lpWideStr, Long cchWide, ;
	String @ lpMultiByte, Long cbMultiByte, Long lpDefaultChar, Long lpUsedDefaultChar
Declare Long SysStringLen In Oleaut32.dll Long bstr
Declare SysFreeString In Oleaut32.dll Long bstr
bstr = 0
VarMonthName(tnMonth, Iif(tlAbbrev, 1, 0), 0, @bstr)
buf = Replicate(Chr(0), 16)
n = WideCharToMultiByte(0, 0, bstr, SysStringLen(bstr), @buf, 16, 0, 0)
SysFreeString(bstr)
Return Left(buf, n)

Function LocalWeekdayName1(tnWeekday, tlAbbrev)
If (VarType(tnWeekday) != 'N') Or (tnWeekday < 1) Or (tnWeekday > 7) Or (VarType(tlAbbrev) != 'L')
	Error 11
EndIf

Local buf, n
Declare Long GetLocaleInfo In Win32API ;
	Long Locale, Long LCType, String @ lpLCData, Long cchData
buf = Replicate(Chr(0), 16)
n = GetLocaleInfo(0, IIf(tlAbbrev, 0x30, 0x29) + tnWeekday, @buf, 16)
Return Left(buf, n - 1)

Function LocalWeekdayName2(tnWeekday, tlAbbrev)
If (VarType(tnWeekday) != 'N') Or (tnWeekday < 1) Or (tnWeekday > 7) Or (VarType(tlAbbrev) != 'L')
	Error 11
EndIf

Local bstr, buf, n
Declare Long VarWeekdayName In Oleaut32.dll ;
	Long iWeekday, Long fAbbrev, Long iFirstDay, Long dwFlags, Long @ pbstrOut
Declare Long WideCharToMultiByte In Win32API ;
	Long CodePage, Long dwFlags, Long lpWideStr, Long cchWide, ;
	String @ lpMultiByte, Long cbMultiByte, Long lpDefaultChar, Long lpUsedDefaultChar
Declare Long SysStringLen In Oleaut32.dll Long bstr
Declare SysFreeString In Oleaut32.dll Long bstr
bstr = 0
VarWeekdayName(tnWeekday, Iif(tlAbbrev, 1, 0), 0, 0, @bstr)
buf = Replicate(Chr(0), 16)
n = WideCharToMultiByte(0, 0, bstr, SysStringLen(bstr), @buf, 16, 0, 0)
SysFreeString(bstr)
Return Left(buf, n)
>Hi All,
>
>I have a problem with the CDOW() command.
>
>In VFP 7.0 it returns german days as expected on a german windows with german VFP
>
>Now I use VFP 8.0 wich MS was unfriendly enough to skip the german version (I know a lot of people that will skip VFP because of that). CDOW() returns english days. I've tried to use the german runtime but that changes nothing.
>
>How to set CDOW() so that it respond the days in the language I neeed?
>
>Agnes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform