I am new to the iPhone developer,
I want to compare two dates, the first date The database will come from, If today is more then Here is my code snippet, but it crashes, and when I compile it, I also see a warning here Any help would be appreciated. The problem is, that you are comparing stars and dates if you < Code> newDate , you will see that it has no newDate and the other is today's date,
newDate then I want to display the warning.
NSString * newDate = [formatter stringFromDate: st]; NSDT * today = [[NSDT allok] Init]; If (compare to today: newdata) == NSordard denending) {NSLog (@ "@ today is a new date compared to date"); } And if ([Compare today: newdeat] == NSordadding) {NSLog (@ "Today is better than today's date"); } Other {nslog (@ "date is same"); }
[compare today: new date]
NSString and
NSDate . If you use
compare: on the law
NSDate , both objects should be
NSDate s. Looking at your code, it looks like
st is
related to NSDate related to
newDate (though your naming sounds a bit strange), try
Today with
newDate instead of
Comments
Post a Comment