源码如下:
import java.text.SimpleDateFormat
import java.util.Date
object timeStamp {
def main (args : Array[String]) : Unit = {
val timeStamp = "1584864313644".toLong
val day =new Date(timeStamp)
val sdf = new SimpleDateFormat("yyyy-MM-dd")
println("sdf="+sdf)
val dayStr: String = sdf.format(day)
println("day="+day)
}
}
运行结果:
sdf=java.text.SimpleDateFormat@f67a0200
day=Sun Mar 22 16:05:13 CST 2020