I am new to iPhone developer,
i want to compare two Dates, first date will come from Database let say, newDate
and second is todays date,
if today is greater then newDate
then i want to display alert.
Here is my code snippet,
NSString *newDate = [formatter stringFromDate:st];
NSDate *today=[[NSDate alloc]init];
if ([today compare:newDate] == NSOrderedDescending)
{
NSLog(@"today is later than newDate");
}
else if ([today compare:newDate] == NSOrderedAscending)
{
NSLog(@"today is earlier than newDate");
}
else
{
NSLog(@"dates are the same");
}
but it crashes, and while compiling it also shows me warning here [today compare:newDate]
Any help will be appreciated.