显示当前时间(按照秒算)

package emg.branchs.test

import java.time.{LocalDateTime, ZoneOffset}

/**
  * @Auther: sss
  * @Date: 2019/1/4 13:49
  * @Description:
  */
object Tests1 {

  def main(args: Array[String]): Unit = {

    val startTime = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))
    Thread.sleep(1000*5) //睡眠5秒
    val endTime = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))

    print("开始时间:"+startTime +"结束时间:"+endTime)
  }
}

猜你喜欢

转载自blog.csdn.net/weixin_41804049/article/details/85781187