- 1. 取得当前系统时间戳
- long long timestamp = [[[[NSDate alloc] init] autorelease] timeIntervalSince1970];
- NSLog(@"t:%qi", timestamp);
- 2. 根据具体的时间,取得其时间戳
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- NSDate *date =[dateFormatter dateFromString:@"2014-12-01 10:11:54"];
-
复制代码 |
|