我正在尝试从NSString格式化NSDate:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEEE, dd.MM.yyyy"];
NSString * appStart = [appointment start];
NSLog(@"app start: %@", appStart);
NSString *startDateFormatted = [dateFormatter stringFromDate:appStart];
NSLog(@"formatted date: %@", startDateFormatted );
输出:
2012-12-31 15:21:04.722 App[3296:907] app start: 2012-12-31 15:00:00
2012-12-31 15:21:04.723 App[3296:907] formatted date: (null)
我做错了什么?
答案 0 :(得分:1)
stringFromDate
将NSDate
*作为参数,而不是NSString
*。如果您需要进一步的帮助,请告诉我......