#75 handleTimestamp caused bugs


What: The handleTimestamp used a hard-coded simpledateformat as "SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); ", When using the CSVWriter.writeAll(), it doesn't provide an argument to define the dateformat. when dumping a database to CSV file, it converts the datetime column from "2011-7-28 11:11:11" to "2011-七月-28 11:11:11"(I'm using CN locale), this will cause bugs when importing this generated CSV to sqlserver because it only accepts strings like "2011-7-28 11:11:11" and convert it into datetime.
The error is as followings:
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting datetime from character string.

Code: http://opencsv.svn.sourceforge.net/viewvc/opencsv/branches/release-2.3/src/au/com/bytecode/opencsv/ResultSetHelperService.java?revision=103&view=markup

Suggestion for fix: Maybe we can let the user pass the format they want as an argument? I believe hard code this kind of format is not the best solution.

First time using sourceforge:)


  • Scott Conway

    Scott Conway - 2011-09-06

    Allow custom date and timestamp formats in getColumnValues. This has been committed in version 104.

  • Scott Conway

    Scott Conway - 2011-09-06
    • assigned_to: nobody --> sconway
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks