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'作爲日期格式 –