Laurie, I don't remember ever running into the issue your code illustrates so copied it and ran it on my system. All the dates showed up without error! If I had nothing else to do I could spend a lot of time trying to duplicate your results but not now,
Thanks for sharing, Joe On Tue, Apr 14, 2015 at 6:20 AM, Laurie Alvey <[email protected]> wrote: > Another issue with CSV files is that dates get mangled. The following code > illustrates this: > > CLOSE DATABASES ALL > SET STRICTDATE TO 0 > SET CENTURY ON > SET SAFETY OFF > CREATE CURSOR tmp (dated D) > INSERT INTO tmp VALUES ({^1999/10/15}) > INSERT INTO tmp VALUES ({^2000/10/15}) > INSERT INTO tmp VALUES ({^2001/10/15}) > BROWSE NORMAL > COPY TO tmp.csv TYPE CSV > MODIFY FILE tmp.csv NOEDIT > COPY TO tmp.txt DELIMITED > MODIFY FILE tmp.txt NOEDIT > ZAP > APPEND FROM tmp.csv TYPE CSV > BROWSE NORMAL && Incorrect dates > APPEND FROM tmp.txt DELIMITED > BROWSE NORMAL && Last three dates are correct > SET STRICTDATE TO 1 > SET SAFETY ON > SET CENTURY ON > > Changing STRICTDATE, DATE and CENTURY settings seem to have no effect. It > looks like APPEND FROM *.csv TYPE CSV assumes a two digit year. I always > use DELIMITED for this sort of operation (even though you don't get field > names). > > Laurie > > On 14 April 2015 at 09:39, Alan Bourke <[email protected]> wrote: > > > You'd have to roll your own. > > > > use mytable > > Set textmerge on noshow > > set textmerge to myfile.csv > > > > lnFields = Fcount("mytable") > > For x = 1 to lnFields > > \\<<Field(x, "mytable", 1)>><<iif(x<lnFields, ",", "")>> > > Endfor > > > > scan > > \\<<field1>>,<<field2>>,<<field3>> > > endscan > > > > Set textmerge off > > set textmerge to > > > > > > -- > > Alan Bourke > > alanpbourke (at) fastmail (dot) fm > > > > On Tue, 14 Apr 2015, at 07:42 AM, Joe Yoder wrote: > > > When I browse a table from a database with some user defined field > names > > > in > > > it I see long meaningful field names as headers but when I copy to file > > > as > > > type CSV I get 10 character gobletty goop for field headers. > > > > > > Is there a built in way to have VFP copy to a CSV file using the field > > > captions from the dictionary for field headers? If not - how do I > > > programatically access the captions to write my own? > > > > > > Thanks in advance, > > > > > > Joe > > > > > > > > > --- StripMime Report -- processed MIME parts --- > > > multipart/alternative > > > text/plain (text body -- kept) > > > text/html > > > --- > > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cabqednuwdevgzzhtakbdyp5rxsmx8yflcbopdkb5kryktre...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

