/**
根据时间获取时间戳
@param formatTime 时间
@param matter 时间格式
@return 时间戳
*/
+(NSInteger)timeSwitchTimestamp:(NSString *)formatTime Formatter:(NSString *)matter{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:matter];
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setTimeZone:timeZone];
NSDate* date = [formatter dateFromString:formatTime];
NSInteger timeSp = [[NSNumber numberWithDouble:[date timeIntervalSince1970]] integerValue];
return timeSp;
}
网友评论