java.text.ParseException:Unparseable date:"201104132200"at java.text.DateFormat.parse(DateFormat.java:337)at org.apache.jsp.manager.new1001.g1001insert_jsp._jspService(g1001insert_jsp.java:382)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspB
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 21:20:57
java.text.ParseException:Unparseable date:"201104132200"at java.text.DateFormat.parse(DateFormat.java:337)at org.apache.jsp.manager.new1001.g1001insert_jsp._jspService(g1001insert_jsp.java:382)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspB
java.text.ParseException:Unparseable date:"201104132200"
at java.text.DateFormat.parse(DateFormat.java:337)
at org.apache.jsp.manager.new1001.g1001insert_jsp._jspService(g1001insert_jsp.java:382)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
源码
java.util.Date operdtime = sfarmat.parse(delaytime);
operstime = new java.sql.Timestamp(operdtime.getTime());
我用
java.util.Date operdtime = sfarmat.parse(delaytime.toString);没用
没什么分了希望大家能帮忙下
java.util.Date now =new java.util.Date();
java.text.SimpleDateFormat sfarmat = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
String strDateTime=sfarmat.format(now);
java.text.ParseException:Unparseable date:"201104132200"at java.text.DateFormat.parse(DateFormat.java:337)at org.apache.jsp.manager.new1001.g1001insert_jsp._jspService(g1001insert_jsp.java:382)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspB
老兄 这个是你大意了吧
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");这里的格式是
4位年 2位月 2位日 2位时 2位分 2位秒 共14位
但是你传入的字符串 只有12位 转换就出错了201104132200变成20110413220000就对了
输入的字符串要和你想要的格式长度神马的都一样才行
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
try {
Date date = sdf.parse("20110413111100");
String s = sdf.format(date);
System.out.println(s);
} catch (ParseException e) {
e.printStackTrace();
}
结果:20110413111100