时间戮转时间

// 时间戮转时间

- (NSString *)timeToStr:(NSString *) str {

NSTimeInterval interval=[[NSString nullToString:str] doubleValue] ;

NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];

NSDateFormatter *objDateformat = [[NSDateFormatter alloc] init];

NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/BeiJing"];

[objDateformat setTimeZone:timeZone];

[objDateformat setDateFormat:@"yyyy-MM-dd"];

NSString * timeStr = [NSString stringWithFormat:@"%@",[objDateformat stringFromDate: date]];

return timeStr;

}

你可能感兴趣的:(时间戮转时间)