获取 Unix 纪元时间
要获得 Unix Epoch Time ,请使用常量 timeIntervalSince1970
:
迅速
let date = NSDate() // current date
let unixtime = date.timeIntervalSince1970
Objective-C
NSDate *date = [NSDate date]; // current date
int unixtime = [date timeIntervalSince1970];