spark怎样获得当前时间戳
在Spark中,可使用Scala语言的System.currentTimeMillis()
方法来获得当前时间戳。具体代码以下:
val currentTimeMillis = System.currentTimeMillis()
println("Current timestamp: " + currentTimeMillis)
在Spark中也能够使用java.sql.Timestamp
类来获得当前时间戳,具体代码以下:
import java.sql.Timestamp
val currentTimeStamp = new Timestamp(System.currentTimeMillis())
println("Current timestamp: " + currentTimeStamp)
TOP