error on NToCDOW

error on NToCDOW

Postby Silvio.Falconi » Sun Aug 05, 2018 11:18 pm

i make a function to converte date string into italian date string

Code: Select all  Expand view

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 ?

Image

for a sample I cannot show sunday on Italian language why ?

please try this small test


Code: Select all  Expand view

#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)

//-------------------------------------------------------------------//





 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: error on NToCDOW

Postby nageswaragunupudi » Mon Aug 06, 2018 8:14 am

Wrong caption.
There is no error with NToCDOW().
The error is with your program.
Please do not use wrong captions.

You need to use

Code: Select all  Expand view

REQUEST HB_Lang_IT
REQUEST HB_CODEPAGE_ITWIN

HB_LangSelect("IT")
HB_SetCodePage("ITWIN")
 


FWDtPick also displays Italian weekdays and months.

If you have FWH 1805, this program:
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST HB_Lang_IT
REQUEST HB_CODEPAGE_ITWIN

function Main()

   HB_LangSelect("IT")
   HB_SetCodePage("ITWIN")


   ? cValToStr( Date(), "dddd dd mmmm yyyy" )

return nil
 


gives this output

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: error on NToCDOW

Postby Silvio.Falconi » Tue Aug 07, 2018 3:17 pm

Rao,
sorry it give bad here

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: error on NToCDOW

Postby karinha » Tue Aug 07, 2018 5:11 pm

Silvio,

FWDtPick also displays Italian weekdays and months.

If you have FWH 1805, this program:
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 48 guests