objc:
long long milliseconds = (long long)([[NSDate date] timeIntervalSince1970] * 1000.0);
swift:
// ex1)
let currentDate = NSNumber(value:Int64(Date().timeIntervalSince1970 * 1000))
// ex2)
extension Date {
func toMillis() -> NSNumber {
return NSNumber(value:Int64(timeIntervalSince1970 * 1000))
}
var timestamp: Int64 {
Int64(timeIntervalSince1970 * 1000)
}
}