formateo fecha xbrowse

formateo fecha xbrowse

Postby artu01 » Tue Jul 23, 2019 11:50 pm

Hola Gente
En xbrowse deseo que la col fecha salga asi dd/mm/yyyy pero no consigo hacerlo

[img]
http://ge.tt/1WmryDx2
[/img]


Code: Select all  Expand view

   SET DATE FORMAT TO "DD/MM/YYYY"

    oCon1:=AbreConexBD()
    cSql:= "SELECT codubi, codusu, tipcam, dsctop, numero, facbol, fecha, moneda, totbruto, totdscto,totsub, totigv, total, ng,"
    cSql+="numfac, tdafab, ruc, estado from cabguia where left(CODUSU,2)='"+left(codusu,2)+"' and mes = '"+cMes+"' order by numero desc"

    lRs:=.f.
    TRY
      oRs1 := TOleAuto():New( "ADODB.RecordSet" )
      WITH OBJECT oRs1
        :ActiveConnection := oCon1
        :Source             := cSql
        :CursorLocation     := adUseClient
        :CursorType         := adOpenStatic
        :LockType           := adLockOptimistic
        :Open()
      END
      lRS := .t.
    CATCH oError
      MsgStop( oError:Description )
    END

    xbrNumFormat( "A", .t. )

    REDEFINE XBROWSE oBrw                                    ;
     DATASOURCE oRs1                                         ;
     COLUMNS "FACBOL","FECHA","NUMERO","NG","MONEDA",;
             "TOTBRUTO","TOTDSCTO","TOTSUB","TOTIGV","TOTAL" ;
      FIELDSIZES 30,68,54,200,30,85,60,60,60,85              ;
      HEADERS                               ;
             "F/B"                          ;
            ,"FECHA"                        ;
            ,"NUMERO"                       ;
            ,"CLIENTE"                      ;
            ,"MON."                         ;
            ,"T.BRUTO"                      ;
            ,"T.DSCTO"                      ;
            ,"SUBTOT"                       ;
            ,"IGV"                          ;
            ,"TOTAL"                        ;
      ID 4001 OF oDlg                       ;
      LINES CELL NOBORDER UPDATE
 


En management studio se ve asi:

[img]
http://ge.tt/7rMtyDx2
[/img]

Gracias
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 399
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: formateo fecha xbrowse

Postby nageswaragunupudi » Wed Jul 24, 2019 12:44 am

Please make sure that you stored dates as dates and not as character data in the table.

By default, xbrowse displays dates in the Set Date format. In addition, you can display dates in a different format by specifying oCol:cEditPicture.

Example:
Code: Select all  Expand view

   local oCn, oRs

   SET DATE FORMAT TO "dd/mm/yyyy"

   oCn   := FW_OpenAdoConnection( "xbrtest.mdb" )
   oRs   := FW_OpenRecordSet( oCn, "customer" )

   XBROWSER oRs COLUMNS "FIRST", "HIREDATE", "HIREDATE", "HIREDATE" ;
   SETUP oBrw:cEditPictures := { nil, nil, "yyyy-mm-dd", "dd mmm yyyy" }

   oRs:Close()
   oCn:Close()
 


Image
Regards

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

Re: formateo fecha xbrowse

Postby artu01 » Fri Jul 26, 2019 10:11 pm

thank you mr. nages, but it does not work
i get this result
[img]
http://s2.subirimagenes.com/otros/previ ... error2.jpg
[/img]

this is my code
Code: Select all  Expand view

    SET DATE FORMAT TO "dd/mm/yyyy"

    xbrNumFormat( "A", .t. )

    REDEFINE XBROWSE oBrw                                    ;
     DATASOURCE oRs1                                         ;
     COLUMNS "FACBOL","FECHA","NUMERO","NG","MONEDA",;
             "TOTBRUTO","TOTDSCTO","TOTSUB","TOTIGV","TOTAL" ;
      FIELDSIZES 30,68,54,200,30,85,60,60,60,85              ;
      HEADERS                               ;
             "F/B"                          ;
            ,"FECHA"                        ;
            ,"NUMERO"                       ;
            ,"CLIENTE"                      ;
            ,"MON."                         ;
            ,"T.BRUTO"                      ;
            ,"T.DSCTO"                      ;
            ,"SUBTOT"                       ;
            ,"IGV"                          ;
            ,"TOTAL"                        ;
      ID 4001 OF oDlg                       ;
      LINES CELL NOBORDER UPDATE      

      oBrw:cEditPictures := { nil, "dd/mm/yyyy" }

 
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 399
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: formateo fecha xbrowse

Postby artu01 » Fri Jul 26, 2019 10:27 pm

nageswaragunupudi wrote:Please make sure that you stored dates as dates and not as character data in the table.

By default, xbrowse displays dates in the Set Date format. In addition, you can display dates in a different format by specifying oCol:cEditPicture.




my field is date as you can see it


[url]
http://s2.subirimagenes.com/otros/previ ... 0tabla.jpg[/url]
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 399
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: formateo fecha xbrowse

Postby nageswaragunupudi » Sat Jul 27, 2019 4:23 am

Can you please do this small test and let us know the results?

After opening the RecordSet oRs1, please insert these lines of code:
Code: Select all  Expand view

oRs1:MoveNext()
? oRs1:Fields( "FECHA" ):Type, ValType( oRs1:Fields( "FECHA" ):Value )
 
Regards

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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Cgallegoa and 58 guests

cron