#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
NSDate *now = [NSDate date];
//时间指针格式
NSLog(@"The time for now is :%p. \n", now);
//时间数据格式
NSLog(@"The time for now is %@", now);
NSLog(@"Hello, World!");
}
return 0;
}
Result:
2018-03-10 14:00:41.983487+0800 TOCNSDatea[36735:12810491] The time for now is :0x10041aaf0.
2018-03-10 14:00:41.983788+0800 TOCNSDatea[36735:12810491] The time for now is Sat Mar 10 14:00:41 2018
2018-03-10 14:00:41.983821+0800 TOCNSDatea[36735:12810491] Hello, World!
Program ended with exit code: 0