共 4 篇文章 |
|
现在时间转为时间戳字符串。NSDate *date = [NSDate date];NSTimeInterval time = [date timeIntervalSince1970];NSString *str = [NSString stringWithFormat:@"%f",time]; 阅177 转1 评0 公众公开 15-01-22 00:29 |
iOS 时间戳转换为时间。NSString *str=@"1368082020";NSDate *detaildate=[NSDate dateWithTimeIntervalSince1970:time];NSLog(@"date:%@",[detaildate description]);NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];//设定时间格式,这里可以设置成自己需要的格式。NSString *currentDateStr = [dateFo... 阅756 转8 评0 公众公开 15-01-20 16:28 |
iOS 时间戳 与 时间相互转化。遇到两个问题,第一是当前时间转化为时间戳,第二是获取的当前时间和系统的时间相差8个小时。//现在时间,你可以输出来看下是什么格式 NSTimeZone *zone = [NSTimeZone systemTimeZone]; NSInteger interval = [zone secondsFromGMTForDate:datenow]; NSDate *localeDate = [datenow dateByAddingTimeInterval: in... 阅15134 转48 评0 公众公开 15-01-20 16:23 |
阅297 转1 评0 公众公开 15-01-20 16:23 |