0
我试图从CSV分析日期如下:如何使用SuperCSV正确解析Joda DateTime?
2016-03-01
要将乔达日期时间与SuperCSV推土机,像这样:
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)
日期时间返回当前日期&时间, 不代表从CSV中读取的日期。
我做错了吗?
'Y'是不一样'y' - 你应该使用'yyyy-MM-DD'作为日期格式 –