Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel VBA Date format problem
Message
 
To
09/06/2014 03:00:07
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01601467
Message ID:
01601469
Views:
38
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform