Scala UTC timestamp in seconds since January 1st, 1970

user1491739 picture user1491739 · Jul 5, 2012 · Viewed 70.2k times · Source

How do I get the Scala UTC timestamp in seconds since January 1st, 1970?

Answer

Dan Simon picture Dan Simon · Jul 5, 2012

Same way as you would in Java:

val timestamp: Long = System.currentTimeMillis / 1000