当前位置:编程学习 > JAVA >>

向数据库里插入系统日期时,出这Cannot format given Object as a Date

数据库里的这字段是Date型

严重: Servlet.service() for servlet AddMessageServlet threw exception
java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.text.DateFormat.format(DateFormat.java:281)
at java.text.Format.format(Format.java:140)
at com.jingang0606.dao.ManagerMesImpl.addMessage(ManagerMesImpl.java:32)
at com.jingang0606.servlet.AddMessageServlet.doPost(AddMessageServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662) --------------------编程问答-------------------- Cannot format given Object as a Date
不能格式化给定的对象做为日期 --------------------编程问答-------------------- 格式转换错误 你传过来的日期格式不能识别 建议传过来的时候先在前台js验证是否合法然后再传过来 --------------------编程问答-------------------- 给定的对象不是Date型
补充:Java ,  Java SE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,