标签:
// 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);
NSDate && TimeStamp
标签:
原文地址:http://www.cnblogs.com/wealon/p/5240997.html