9
如何从NSDateFormatter
格式转义字符?Escape NSDateFormatter字符串
NSDate *currentDate = [NSDate date];
NSDateFormatter *dateFormater = [[NSDateFormatter alloc] init];
[dateFormater setDateFormat:@"dd/MM/yyyy \\a\\t HH:mm"];
NSString *dateFormated = [dateFormater stringFromDate:currentDate];
NSLog(@"%@", dateFormated);
书签[日期格式化程序(https://developer.apple。 com/library/ios /#documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html)以及[IEEE Date Format Specification](http://www.unicode.org/reports/tr35/) tr35-25.html#Date_Format_Pattern S)。任何使用'NSDateFormatter'的人都应该阅读这些页面。 – rmaddy