Skip to content

Instantly share code, notes, and snippets.

@ntreadway
Created July 24, 2015 21:03
Show Gist options
  • Save ntreadway/e04b9ca0da323b6c1aa1 to your computer and use it in GitHub Desktop.
Save ntreadway/e04b9ca0da323b6c1aa1 to your computer and use it in GitHub Desktop.
Unix timestamp to NSdate
for message in result.data.messages {
let json = JSON(message)
var date : NSDate!
if let messageDate = json["timetoken"].number {
let dateAsInt = messageDate as NSInteger!
let unixTime = dateAsInt / 10000000
date = NSDate(timeIntervalSince1970: NSTimeInterval(unixTime))
}
println("my date \(date)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment