以前我看到不少和這個差很少的方法
java
Date date1 = new Date(); spa
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); code
String str1 = sdf1.format(date1)orm
用上面這個的話仍是報錯,類型對不上。後面改了下form
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSS"); gongWenDoc.setCreateDate(sdf.format(new Date()));