Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare two nsdatecomponent

if I have two nsdatecomponent and I want a know if the TIME in the first object is bigger than the second.

example:

if (nsdatecomponentObject1 > nsdatecomponentObject2)
{
    //something
}

Because this way don't works, how I can do this?

like image 509
alex Avatar asked Feb 26 '23 23:02

alex


1 Answers

Use compare: on the NSDate of the NSDateComponent.

if([[nsdatecomponentObject1 date] compare:[nsdatecomponentObject2 date]] == NSOrderedAscending)
like image 173
Jacob Relkin Avatar answered Mar 10 '23 16:03

Jacob Relkin