java.text.ParseException: Unparseable date: "201104132200"
java.text.ParseException:Unparseabledate:"201104132200"atjava.text.DateFormat.parse(D...
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); 展开
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); 展开
展开全部
老兄 这个是你大意了吧
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
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
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询