我想在UTC中显示UTC当前时间与UTC值之间的差异。
答案 0 :(得分:0)
以下情况如何?
import java.time._
val time1 = Instant.parse("2017-01-01T12:00:00Z")
val time2 = Instant.now()
val diff = Duration.between(time1, time2)
println("Difference is " + diff)
println("or in seconds: " + diff.getSeconds())
进一步阅读: