user2636197
user2636197

Reputation: 4122

Swift ios 10 digit unix timestamp

I wonder how I can create a 10 digit unix timestamp

NSDate().timeIntervalSince1970

will print: 1478638179.2932

I would like to only print:

1478638179

Upvotes: 2

Views: 3729

Answers (1)

rmaddy
rmaddy

Reputation: 318854

You mean you just want the integral part of the value?

let seconds = Int(NSDate().timeIntervalSince1970)

Upvotes: 15

Related Questions