1

我正在尝试从 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)

我究竟做错了什么?

4

1 回答 1

1

stringFromDateNSDate* 作为参数,而不是NSString*。如果您需要进一步的帮助,请告诉我...

于 2012-12-31T14:25:30.033 回答