ios 日期时间打印

NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-mm-dd hh:mm:ss"];
NSString *strDate = [format stringFromDate:[NSDate date]];
DLog(@"%@", strDate);

其中DLog定义

#ifdef DEBUG
    #define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
    #define DLog(fmt, ...)
#endif

打印log如下:

[CViewController textFieldShouldReturn:] [Line 49] 2014-30-15 09:30:36

原文地址:https://www.cnblogs.com/ftrako/p/3520188.html