- Code: Select all Expand view RUN
Function cf(dTemp)
LOCAL f, m, cMese, dFech,dDay,d
Local i,c
local aMesi[ 12 ]
local aWeek[ 7 ]
AEval( aMesi, { |c,i| aMesi[ i ] := NToCMonth( i ) } )
AEval( aWeek, { |c,i| aWeek[ i ] := NToCDOW( i ) } )
* xbrowser aWeek
* xbrowser aMesi
f:=DTOS (dTemp)
m:=MONTH(dTemp)
d:=dow(dtemp)
* ? d
cMese:=IF(m<>0, aMesi[m] ,"" )
dday :=IF(d<>0, aWeek[d] ,"")
dFech:=IF(m<>0,dday+", "+ SubStr(f,7,2)+' '+cMese+' '+SubStr(f,1,4),'')
RETURN (dFech)
sample : "Lunedì, 6 Agosto 2018 "
I set the Language to Italian with
REQUEST HB_LANG_IT
and
SET DATE ITALIAN
HB_LangSelect("IT")
but the NToCDOW and NToCMonth give me the day string and month string in english and bad
for a sample today is Monday but the function show me friday why ?
for a sample I cannot show sunday on Italian language why ?
please try this small test
- Code: Select all Expand view RUN
#include "FiveWin.ch"
#include "constant.ch"
//----------------------------------------------------------------------------//
REQUEST HB_LANG_IT
function Main()
local oDlg , aGet := Array(5), oBtnCal
local dDataNote:=cf(date())
SET _3DLOOK ON
SET CENTURY ON
SET DATE ITALIAN
HB_LangSelect("IT")
DEFINE DIALOG oDlg SIZE 400,200
@ 12,5 SAY "Note di :" OF oDlg PIXEL SIZE 100,20 TRANSPARENT
@ 10,35 GET aGet[1] VAR dDataNote SIZE 80,12 PIXEL OF oDlg ;
BITMAP ".\bitmaps\cal.bmp" ACTION NIL
@ 07,170 BTNBMP oBtnCal FILENAME ".\bitmaps\date.bmp" FLAT SIZE 20,14 PIXEL OF oDlg NOBORDER
oBtnCal:oPopUp:= { |oBtn| BtnPopCalMenu( @dDataNote,aGet) }
ACTIVATE DIALOG oDlg CENTERED
return nil
//---------------------------------------------------------------------//
Function BtnPopCalMenu( dDataNote,aGet)
Local oPopupDate
MENU oPopupDate POPUP 2015
MENUITEM "Oggi" ACTION (dDataNote:=date(),aGet[1]:CTEXT(cf(dDataNote)),aGet[1]:refresh())
MENUITEM "Domani" ACTION ( dDataNote:=date()+1 ,aGet[1]:CTEXT(cf(dDataNote)),aGet[1]:refresh())
MENUITEM "DopoDomani" ACTION ( dDataNote:=date()+2,aGet[1]:CTEXT(cf(dDataNote)),aGet[1]:refresh())
SEPARATOR
MENUITEM "Pulisci" ACTION ( dDataNote:="",aGet[1]:CTEXT((dDataNote)),aGet[1]:refresh())
ENDMENU
return oPopupDate
//-------------------------------------------------------------------//
Function cf(dTemp)
LOCAL f, m, cMese, dFech,dDay,d
Local i,c
local aMesi[ 12 ]
local aWeek[ 7 ]
AEval( aMesi, { |c,i| aMesi[ i ] := NToCMonth( i ) } )
AEval( aWeek, { |c,i| aWeek[ i ] := NToCDOW( i ) } )
* xbrowser aWeek
* xbrowser aMesi
f:=DTOS (dTemp)
m:=MONTH(dTemp)
d:=dow(dtemp)
* ? d
cMese:=IF(m<>0, aMesi[m] ,"" )
dday :=IF(d<>0, aWeek[d] ,"")
dFech:=IF(m<>0,dday+", "+ SubStr(f,7,2)+' '+cMese+' '+SubStr(f,1,4),'')
RETURN (dFech)
//-------------------------------------------------------------------//