java读取Excel中日期格式转换工具
//Excel中日期格式转换
private Date cellToDate(Cell dateCell){
if(0==dateCell.getCellType()){
if(DateUtil.isCellDateFormatted(dateCell)){
//用于转化为日期格式
Date d = dateCell.getDateCellValue();
DateFormat formater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = formater.format(d);
return DateUtils.formatStringToDate(date, DateUtils.YYYY_MM_DDHHMMSS);
}
}
return null;
}
还没有评论,来说两句吧...