update方法我傳了last_edit_time字段傳入了new Date(),但是報(bào)錯了,更新不了
Caused?by:?com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:?You?have?an?error?in?your?SQL?syntax;?check?the?manual?that?corresponds?to?your?MySQL?server?version?for?the?right?syntax?to?use?near?'last_edit_time='2019-02-01?11:07:02.26'?????????WHERE?area_id=7'?at?line?4 at?sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native?Method) at?sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at?sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at?java.lang.reflect.Constructor.newInstance(Constructor.java:408)
我看到傳入的date多了小數(shù)點(diǎn),于是把小數(shù)點(diǎn)去掉后再轉(zhuǎn)成date類型的,發(fā)現(xiàn)也不行,也報(bào)這個(gè)錯誤,后面的時(shí)間是沒有小數(shù)點(diǎn)的,我數(shù)據(jù)庫的版本是5.7,這個(gè)問題怎么解決呢
2019-02-13
我也是這個(gè)問題
2019-02-02
確認(rèn)是java的date還是sql的date