objective c - Checking textfield value for date in iOS -


i used 3 textfield(string) , 1 button display entered textfield in soap result.

when clicked button

textfield1=stationid --> 12345                     textfield2 =firstdate --> 07.05.2013 textfield3=lastdate  ---> 08.05.2013 

searching , display somethings etc etc

i want check date processes.for example must lastdate > firstdate.if entered firstdate > lastdate give error if user entered 30.02.2014 dates firstdate , lastdate must have give error.february has not 30 days.``

how can ??

try this,

 nsdateformatter *dateformat = [[nsdateformatter alloc] init];     [dateformat setdateformat:@"dd.mm.yyyy"];     nsdate *today = [dateformat datefromstring:@"12.12.2013"];      nsdate *newdate = [dateformat datefromstring:@"13.12.2013"];      nscomparisonresult result;      result = [today compare:newdate]; // comparing 2 dates     if(result==nsorderedascending)  // checks lastdate > firstdate         nslog(@"correct");     else          nslog(@"error"); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -