// 计算 距离现在的时间
-(NSString *)getUTCFormateDate:(NSString *)newDate
{
// newsDate = @"2016-01-19 09:01";
NSDateFormatter *dateFormatter = [[NSDateFormatteralloc] init];
[dateFormattersetDateFormat:@"yyyy-MM-dd HH:mm"];
NSLog(@"newsDate = %@",newDate);
NSDate *newsDateFormatted = [dateFormatter dateFromString:newsDate];
NSTimeZone *timeZone = [NSTimeZonetimeZoneWithName:@"UTC"];
[dateFormattersetTimeZone:timeZone];
NSDate* current_date = [[NSDatealloc] init];
NSTimeInterval time=[current_date timeIntervalSinceDate:newsDateFormatted];//间隔的秒数
int month=((int)time)/(3600*24*30);
int day=((int)time)/(3600*24);
int hour=((int)time)%(3600*24)/3600;
int minute=((int)time)%(3600*24)/60;
NSLog(@"time=%d",(double)time);
NSString *dateContent = nil;
if(month!=0){
dateContent = [NSStringstringWithFormat:@"%@%i%@",@" ",month,@"个月前"];
}elseif(days!=0){
dateContent = [NSStringstringWithFormat:@"%@%i%@",@" ",days,@"天前"];
}elseif(hours!=0){
dateContent = [NSStringstringWithFormat:@"%@%i%@",@" ",hours,@"小时前"];
}elseif(minute !=0){
dateContent = [NSStringstringWithFormat:@"%@%i%@",@" ",minute,@"分钟前"];
}else
{
dateContent =@"刚刚";
}
NSLog(@"dateContent %@",dateContent);
return dateContent;
}