wealon
我是wealon 专注于iOS 移动App开发

导航

统计
 
// 1. NSDate to timeStamp
NSString *timeSp = [NSString stringWithFormat:@"%d", (long)[localeDate timeIntervalSince1970]];
// timeStamp
NSLog(@"timeSp:%@",timeSp);
 
// 2. 获取当前时间
NSDate *datenow = [NSDate date];
 
NSTimeZone *zone = [NSTimeZone systemTimeZone];
 
NSInteger interval = [zone secondsFromGMTForDate:datenow];
 
NSDate *localeDate = [datenow dateByAddingTimeInterval: interval];
 
NSLog(@"%@", localeDate);
 
 
 
// 3. timestamp to NSDate
NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:1363948516];
 
NSLog(@"1363948516 = %@",confromTimesp);
posted on 2016-03-04 09:47  wealon  阅读(138)  评论(0编辑  收藏