iOS获取当前时间戳

#pragma mark ======获取当前时间戳=======

- (NSString*)getCurrentTime {

NSDate*datenow = [NSDatedate];

NSString*timeSp = [NSStringstringWithFormat:@"%ld", (long)[datenowtimeIntervalSince1970]];

NSTimeZone*zone = [NSTimeZonetimeZoneWithName:@"Asia/Beijing"];

NSIntegerinterval = [zonesecondsFromGMTForDate:datenow];

NSDate*localeDate = [datenowdateByAddingTimeInterval:interval];

NSString*timeSpp = [NSStringstringWithFormat:@"%f", [localeDatetimeIntervalSince1970]];

returntimeSp;

}

你可能感兴趣的:(iOS获取当前时间戳)