我如何NSLog NSDate? [英] How do I NSLog an NSDate?
本文介绍了我如何NSLog NSDate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面粘贴的代码,我正在尝试记录NSDate。我在这里做错了什么?
With the code pasted below, I am trying to log an NSDate. What am I doing wrong here?
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY-MM-dd"];
NSDate *todaysDate;
todaysDate = [NSDate date];
NSLog(@"Todays date is %@",formatter);
推荐答案
您所要做的就是:
NSLog(@"Todays date is %@",[formatter stringFromDate:todaysDate]);
这篇关于我如何NSLog NSDate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文