formateo fecha xbrowse

Post Reply
artu01
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

formateo fecha xbrowse

Post by artu01 »

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


   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
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: formateo fecha xbrowse

Post by nageswaragunupudi »

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


   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
artu01
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: formateo fecha xbrowse

Post by artu01 »

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


    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: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: formateo fecha xbrowse

Post by artu01 »

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
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: formateo fecha xbrowse

Post by nageswaragunupudi »

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


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

G. N. Rao.
Hyderabad, India
Post Reply