scala获取当前时间戳和今天0时时间戳(精确到秒)的小工具

来源:互联网 发布:叉叉助手最新源码 编辑:程序博客网 时间:2024/05/01 11:37
package com.unicomimport java.text.SimpleDateFormatimport java.util.Date/**  * Created by Administrator on 2016/10/21.  */object TimeUtils {  val now = new Date()  def getCurrent_time(): Long = {        val a = now.getTime        var str = a+""        str.substring(0,10).toLong  }  def getZero_time():Long={      val dateFormat = new SimpleDateFormat("yyyy-MM-dd")      val a = dateFormat.parse(dateFormat.format(now)).getTime      var str = a+""      str.substring(0,10).toLong  }}

2 0