def NowDate(): String = {
val now: Date = new Date()
val dateFormat: SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
val date = dateFormat.format(now)
return date
}
executeUpdate("UPDATE message SET send_state=?,send_time=? WHERE message_id=?" , (stmt)=>{
stmt.setInt(1,2)
stmt.setString(2,NowDate())
stmt.setInt(3,messageId)
})
executeUpdate("UPDATE message SET send_state=?,send_time=NOW() WHERE message_id=?" , (stmt)=>{
stmt.setInt(1,2)
stmt.setInt(2,messageId)
})
这里NOW() 和 NowDate() 效果一样