您的位置:首页 > 其它

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

2016-10-21 17:52 309 查看
package com.unicom

import java.text.SimpleDateFormat
import 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
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: