美文网首页
IOS 时间格式转换

IOS 时间格式转换

作者: pakio | 来源:发表于2015-09-29 13:57 被阅读152次

//时间转换

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

NSString*time =str;

NSDateFormatter*formatter = [[NSDateFormatteralloc]init];

[formattersetDateStyle:NSDateFormatterMediumStyle];

[formattersetTimeStyle:NSDateFormatterShortStyle];

[formattersetDateFormat:@"YYYY-MM-dd HH:mm"];

NSDate*confromTimesp = [NSDatedateWithTimeIntervalSince1970:(NSTimeInterval)[timeintValue]];

NSString*confromTimespStr = [formatterstringFromDate:confromTimesp];

returnconfromTimespStr;

}

相关文章

网友评论

      本文标题:IOS 时间格式转换

      本文链接:https://www.haomeiwen.com/subject/jsgwcttx.html