Agreed, feel free to raise an improvement ticket.
2014-04-22 14:24 GMT+02:00 Gary Gregory <[email protected]>: > For 1.0 at least, we do not plan on doing any type conversion. Later, > perhaps, but the current thought is to leave type conversion to other > components. > > Gary > > > On Tue, Apr 22, 2014 at 7:22 AM, Rupert Wood <[email protected]> wrote: > > > Hi - > > > > > > > > It would be useful if printing a Java Date or Calendar to a > CSVFormat.EXCEL > > CSVPrinter would generate output that Excel recognises as a > date-and-time. > > For example the following > > > > > > > > PrintWriter outputWriter = new PrintWriter(new > > FileOutputStream("output.csv")); > > > > CSVPrinter printer = new CSVPrinter(outputWriter, CSVFormat.EXCEL); > > > > printer.print(new Date()); > > > > printer.println(); > > > > printer.close(); > > > > > > > > outputs the raw Date.toString() > > > > > > > > Tue Apr 22 12:06:42 BST 2014 > > > > > > > > which Excel only treats as a string. (It will recognise e.g. yyyy/mm/dd > as > > a > > date but I wouldn't know where to look for a definitive set of formats it > > will consume.) Ditto probably printing Calendar.getInstance(), or the new > > Java 8 LocalDate etc. classes. > > > > > > > > One argument against though is then the library perhaps ought to do the > > reverse, i.e. spot that it has been passed a date in and construct a Date > > class for the value at parse time which may be expensive and often > > unnecessary. > > > > > > > > Thanks for your consideration. Happy to raise a JIRA 'Wish' ticket if > this > > seems reasonable. > > > > > > > > Rupert. > > > > > > > > > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition< > http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter
