我正试图像这样从CSV解析日期:
2016-03-01
使用SuperCSV推土机到Joda DateTime,像这样:
private static final String[] FIELD_MAPPING = new String[] {"date"};
final CellProcessor[] processors = new CellProcessor[] {
new ParseDateTime(DateTimeFormat.forPattern("YYYY-MM-DD"))
};
CsvDozerBeanReader beanReader = new CsvDozerBeanReader(
new FileReader("/path/to.csv"), CsvPreference.STANDARD_PREFERENCE);
beanReader.configureBeanMapping(MyDateHoldingBean.class, FIELD_MAPPING);
MyDateHoldingBean bean = beanReader.read(EmployeeDetails.class, processors)
返回的DateTime是当前日期&时间,不代表从CSV 读取的日期。
我做错了吗?