iphone - Create Event with NSDate -


is there way create events nsdate ? here code

    nsdate *date = [nsdate date];            nsdateformatter *dateformatter = [[[nsdateformatter alloc] init] autorelease];     [dateformatter setdateformat:@"mmmm d, yyyy"];     nsstring *datestr = [dateformatter stringfromdate:date];      mydate.text = datestr; 

for example if date = 12 feb ; mydate .text = @"mother day";

something

sure is. have split date day , month using nsdatecomponents

you write method this:

- (bool)date:(nsdate *)date issameasday:(nsinteger)day andmonth:(nsinteger)month {     nsuinteger dateflags = nsdaycalendarunit | nsmonthcalendarunit;     nsdatecomponents *components = [[nscalendar currentcalendar] components:dateflags fromdate:date];     if ([components day] == day && [components month] == month) {         return yes;     }     return no; } 

and use this

if ([self date:[nsdate date] issameasday:12 andmonth:2]) {    mydate.text = @"mother day"; } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -