我正在使用 NSDateFormatter,如下所示:
- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)d {
NSLog(@"calendarMonthView didSelectDate %@",d);
NSDate *tempDate = [[NSDate alloc]init];// = d;
NSString *selectedDate = @"2013-02-01 00:00:00 +0000";
//NSString *selectedDate = @"2013-02-04";
NSDateFormatter *dateformatter = [[NSDateFormatter alloc]init];
[dateformatter setDateFormat:@"yyyy-MM-DD hh:mm:ss ZZZZ"];
tempDate = [dateformatter dateFromString:selectedDate];
//if([tempDate compare:d])
if([tempDate isEqualToDate:d])
{
flagtoCheckSelectedCalendarDate = 1;
}
if(flagtoCheckSelectedCalendarDate == 1)
{
[self viewDidLoad];
}
if(flagtoCheckSelectedCalendarDate == 2)
{
[self viewDidLoad];
}
//[table reloadData];
}
为什么这个输出我的日期是错误的?我要去哪里错了?请建议。