What are you doing, when you don't go through CSV?
Code:
SELECT workare && having an export cursor or DBF
COPY TO some.XLS TYP XL5
This is the simplest way to export, converting to new XLSX then is possible by opening the file in Excel and saving as the new standard format. All types go over as they are, there's no date to text conversion unless your dates already are just text in the VFP DBF. So what query do you use to prepare your export cursor or DBF? If you do anything like DTOC(), then that's your fault.
To determine how Excel displays dates, use Excel settings, I'm not even talking about setting the formatting of a column within the sheet, but telling Excel what display format to use in general. It'll typically display dates as Windows is configured in the locale about many things like clock 12(am/pm)/24 hours, money currency, decimal point, 1000s separator for numbers etc. and, of course, dates. They all have a culture specific locale.
When you keep data at their native type, the COPY TO export works. You're only needing a text formatting in your export SQL query, if you want to go through CSV, as CSV by definition means all data types are converted to text and put in a text file.
In your thread thread184-1777988 I told you when it comes to appending CSV into a Foxpro DBF, Foxpro expects yyyymmdd. That's documented in the help for the SDF format in both the help chapters on APPEND and COPY TO, but also valid for CSV. You also get CSV imported correctly if you format to US format on US Windows, both FoxPro and Excel don't limit CSV import to need that yyyymmdd format, but in case you don't you depend on current settings. When you make a query converting date columns into any textual format, you have a string column and then exporting to excel via COPY TO TYPE XLS/XL5 or also EXPORT is not looking at your char column as a date anymore, brings over the textual value as textual value. Just keep it at a date type column in VFP and it gets transferred into a date type cell in the Excel sheet.
Finally, to make the point clear and address your post subject "Date Conversions": That's already your error. You DON'T convert a FoxPro date to text before Excel export, you only do so before or at SDF/CSV export. There is only harm in converting dates to text here. No matter, if you use COPY TO TYPE XLS/XL5, EXPORT TYPE XLS/XL5 or automate Excel and fill in cells, you don't convert to text in that steps in the hope Excel then converts back to date. COPYTO/EXPORT has VFP runtime knowledge about building an XLS binary file containing the date as Excel needs it in his binary native format, using OLE automation that type conversion is done by OLE via using the intermediate OLE date type (OLE is used to mediate between different programming languages and applications, called type marshalling, it happens for example when setting an excels Cell(row,col).Value = DATE(), for example, the OLE server takes in VFPs native DATE as OLE date and puts it in as Excel date, for text properties SYS(3101) can help making the correct codepage conversion, but native types like date don't need that), as OLE is the link between any languages own native binary date type. This is not your concern. This only get's a conversion temporarily as text again, if you're using the dreadful _vfp.DatatoClip(). To make that work, you need to set the Excel sheet column format before pasting, as you then paste a fully textual tab delimited _cliptext. It's often seen as advanced and performant, but it's backward, it's totally unelegant, imitating what you manually do. Whenever I'm bound to manually copy&paste data from one applications grid into excel sheets I already expect to need to fix some columns, the clipboard is the least effective transfer medium to transport different types. There are different types clipboard formats, but all of them only are for the whole clipboard, eg images can be copy and pasted, but DataToClip is not keeping your VFP data as native type single values all just somehow magically separated by tabs. Conversion to text always risks any data you want to arrive as what it was to arrive as text instead.
Bye, Olaf.