>FUNCTION My_CMONTH > LPARAMETERS; > tvDate > > LOCAL; > lnLang AS INTEGER > > lnLang = SUBLANG_ENGLISH_UK && 0x0800; A Language as defined in foxpro.h > RETURN LocalMonthName(MONTH(tvDate),.T.,lnLang) >ENDFUNC &&My_CMONTH > >FUNCTION LocalMonthName &&Bestimmt per API Ruf Monatsnamen in beliebiger Sprache > LPARAMETERS; > tnMonth,; > tvAbbrev,; > tnLang > > LOCAL; > lcBuffer AS CHARACTER,; > lnChars AS INTEGER > > IF (!VARTYPE(tnMonth)=T_Numeric) OR !BETWEEN(tnMonth,1,12) THEN > ERROR 11 > ENDIF &&(!VARTYPE(tnMonth)=T_Numeric ... > > tvAbbrev = IIF(EMPTY(tvAbbrev),0x37,0x43) > >*System default if nothing is given >tnLang = IIF(VARTYPE(tnLang)=T_Numeric,tnLang,0) > > DECLARE LONG GetLocaleInfo IN Win32API ; > LONG Locale, LONG LCType, STRING @ lpLCData, LONG cchData > > lcBuffer = REPLICATE(CHR(0), 16) > lnChars = GetLocaleInfo(tnLang, tvAbbrev+tnMonth,@lcBuffer,16) > RETURN LEFT(lcBuffer,lnChars-1) >ENDFUNC &&LocalMonthName >>
>#DEFINE CMONTH My_CMonth >>this will redefine all CMONTH ad once. But this depends on the design.
> tvAbbrev = IIF(EMPTY(tvAbbrev),0x29,0x30) >>
>>lparameters tnMonth >> >>* The following allows passing a date, or a number, as a parameter. >>if type("tnMonth") = "D" >> tnMonth = month(tnMonth) >>endif >> >>do case >>case tnMonth = 1 >> return "January" >>case tnMonth = 2 >> return "February" >>... >>otherwise && Some wrong input, perhaps? >> return "???" >>endcase >>>>