美文网首页
将yyyy-MM-dd HH:mm:ss格式时间转换成时间戳

将yyyy-MM-dd HH:mm:ss格式时间转换成时间戳

作者: 西博尔 | 来源:发表于2016-07-12 17:27 被阅读343次

+(long)changeTimeToTimeSp:(NSString *)timeStr{
long time;
NSDateFormatter *format=[[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *fromdate=[format dateFromString:timeStr];
time= (long)[fromdate timeIntervalSince1970];

return time;

}

相关文章

网友评论

      本文标题:将yyyy-MM-dd HH:mm:ss格式时间转换成时间戳

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