Created
July 24, 2015 21:03
-
-
Save ntreadway/e04b9ca0da323b6c1aa1 to your computer and use it in GitHub Desktop.
Unix timestamp to NSdate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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