以下代码可以解决这个问题:

if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC 
&& cell.getCellStyle().getDataFormat() == 
HSSFDataFormat.getBuiltinFormat("h:mm")){
			String sDate = cell.getNumericCellValue()+"";
			if(!StringUtil.isEmpty(sDate)){
				Date date = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
				return new SimpleDateFormat("h:mm").format(date);
			}
			return "";
}
 
其中,单元格的格式属性是custom h:mm
评论
发表评论

您还没有登录,请登录后发表评论

cai555
搜索本博客
最近加入圈子
存档
最新评论