数据库是Date类型。实体类里是String类型。用的hibernatedaosupport的save()方法保存到oracle数据库,
已经用simpledateformat转换过了
// SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
// email.setSendTime(sf.format(new Date()));但还是报错啊
literal does not match format string
已经用simpledateformat转换过了
// SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
// email.setSendTime(sf.format(new Date()));但还是报错啊
literal does not match format string
YYYY-MM-DD HH:MI:SS
你这格式才是错的啊java.lang.IllegalArgumentException: Illegal pattern character 'Y'
我这是to_date转换时候用的!
SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String strDateTime = "2010-09-21 15:30:21";
email.setSendTime(sf.parse(strDateTime));
//如果直接获取的当前时间
email.setSendTime(new java.util.Date());