请帮我解决问题。
(objValidation.aRange.MinimumValue、objValidation.aRange.MaximumValue 的值来自网络服务)
(我在 firstDate、secondDate 的日期有误。)
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"MM/dd/yyyy"];
[df setTimeZone:[NSTimeZone localTimeZone]];
NSDate *myDate = [df dateFromString:inputString];
[df setDateFormat:@"MM/dd/yyyy"];
NSLog(@"objValidation.aRange.MinimumValue : %@,objValidation.aRange.MaximumValue :%@, inputString : %@",objValidation.aRange.MinimumValue,objValidation.aRange.MaximumValue,inputString);
NSDate *firstDate = [df dateFromString:objValidation.aRange.MinimumValue];
NSDate *secondDate = [df dateFromString:objValidation.aRange.MaximumValue];
NSLog(@"myDate : %@,firstDate :%@, secondDate : %@",myDate,firstDate,secondDate);
[df release];
输出:
objValidation.aRange.MinimumValue : 8/20/2013
objValidation.aRange.MaximumValue :12/31/9999
inputString : 08/22/2013
myDate : 2013-08-21 18:30:00 +0000
firstDate :2013-08-19 18:30:00 +0000
secondDate : 1999-12-30 18:30:00 +0000