0

我有以下代码

NSDate * selectedDate = self.datePicker.date;

NSLog(@"The date selected is %@ and initialdate is %@", selectedDate, initialDate);

NSLog(@"the expression value is %i", [self.initialDate isEqualToDate:selectedDate]);

打印以下内容

The date selected is 2012-09-24 18:49:04 +0000 and initialdate is 2012-09-24 18:49:04 +0000

the expression value is 0

我正在使用 xcode4.5 并针对 ios6。xcode4.4 中的相同代码打印1(它们是相等的)

4

1 回答 1

0

我得到了它。

当我添加以下行时

NSLog(@"Initaldate with time intervel since 1970 %f  and selecteddate %f", [initialDate timeIntervalSince1970], [selectedDate timeIntervalSince1970]);

它在 iOS 5 中打印相同的值,但在 iOS6 中打印不同的值。

于 2012-09-24T19:44:35.710 回答