Java数据库保存时分秒时间

        String sql = "UPDATE U_DIST_TASK T SET T.MADE_TIME = to_date(?,'YYYY-MM-DD HH24:MI:SS') WHERE T.TASK_NO = ?";
        DateFormat sdf = new SimpleDateFormat("HH:mm:ss");     
        java.sql.Timestamp time = new java.sql.Timestamp(System.currentTimeMillis());     
        String dateStr = taskPo.getMadeTime()+" "+sdf.format(time);
        Object[] taskdetParam = {dateStr,taskPo.getTaskNo()};
        hibernateDao.updateWithSql(sql.toString(),taskdetParam);

转载于:https://www.cnblogs.com/luxuexin/p/9237692.html

你可能感兴趣的:(Java数据库保存时分秒时间)