用java导出excel表格问题
我用java导出excel表格出了点问题,其中有个字段是时间大概格式是2000-01-01 12:12:12 这个样的格式,但导出后时间就成了12:12 了,从分开始的时间了。求解
我是在java直接传送一个字符串到jsp页面由JSP生成。
一下是jsp页面的代码。
<%
String fileName = (String)request.getAttribute("fileName");
if(fileName == null || fileName.equals("")){
fileName = request.getParameter("fileName");
}
System.out.println("filename:"+fileName);
String returnStr =(String)request.getAttribute("returnStr");
System.out.println(returnStr);
try{
response.setHeader("Content-disposition","inline; filename="+fileName+"("+ FormatDate.toY_M_D(FormatDate.getCurrDate()) +")"+".xls");
}catch(Exception e){
e.printStackTrace();
}
%>
<html>
<style>
TD {
FONT-SIZE: 12px; LINE-HEIGHT: 160%; FONT-FAMILY: 宋体;
}
.style9 {color: #000000;
font-size: 22px;
font-weight:bold;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<body>
<%=returnStr%> //传过来的字符串
</body>
</html>
在excel表格里可以修改时间格式,但每次导出都要修改很麻烦,有木有办法在导出时时间格式就弄成我要的。我要的是2001/01/01 12:12:12 大概这样的时间格式。