SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
2.String时间转date格式:
/**
* 将短时间格式字符串转换为时间 yyyy-MM-dd
*
* @param strDate
* @return
*/
public static Date strToDate(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 数据库操作
*/
int i = Db.update("update ZC_YEARS_PIWEN t set WENHAO='"+map.get("pwnumber0")+"',FAWENSJ=to_date('"+map.get("fawensj0")+"','yyyy-mm-dd hh24:mi:ss') where t.id='"+id+"'");