>Hi
>I want to export the invoice no and invoice date to the Excel worksheet,
>I set the date to british, the date format is dd-mmm-yyyy,
>the record of the invoice date format in the invoice.dbf is store in mm/dd/yy,
>I find that if the invoice date in invoice file is 5/24/14, the output of the cell is in 24-May-2014, it is dd-mmm-yyyy correct format ,
>but if the invoice date in invoice file is 5/7/14, the output of the cell is still is 05-Jul-2014, I think it should be 07-May-2014.(dd-mm-yyyy)
>why it change ?
>Please advise.
>
>
>SET DATE BRITISH
>oExcel = CREATEOBJECT([Excel.Application])
>oExcel.SheetsInNewWorkbook = 4
>oWorkbook = oExcel.Workbooks.Add()
>nrow=2
>select invoice
>do while !eof()
> with oExcel.activesheet
> .Range("A"+TRIM(PADR(nrow,11))).value="'"+dtoc(invoice->invno)
> .Range("B"+TRIM(PADR(nrow,11))).NumberFormatLocal ='General'
> .Range("B"+TRIM(PADR(nrow,11))).value=dtoc(invoice->invdate)
> endwith
> nrow = nrow + 1
> select invoice
> skip 1
>enddo
>
>Thanks.
>Derek
dd stays for DAYS
mm stays for month.
That is whay when you put 05/07/2014 and format the cell "dd-mm-yyyy" you get 05 JUL 2014.
Try to use "mmm-dd-yyyy" format.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.