码迷,mamicode.com
首页 > 其他好文 > 详细

Scala 获取当前时间

时间:2017-06-03 15:05:56      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:where   time   int   exec   ret   simple   cal   state   upd   

  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() 效果一样

Scala 获取当前时间

标签:where   time   int   exec   ret   simple   cal   state   upd   

原文地址:http://www.cnblogs.com/soyo/p/6937097.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!