Get Date
Nsarray * Arrweek=[nsarray arraywithobjects:@ "Sunday", @ "Monday", @ "Tuesday", @ "Wednesday", @ "Thursday", @ "Friday", @ "Saturday", nil];
NSDate *date = [NSDate Date];
Nscalendar *calendar = [[Nscalendar alloc] Initwithcalendaridentifier:nsgregoriancalendar];
Nsdatecomponents *comps = [[Nsdatecomponents alloc] init];
Nsinteger unitflags = Nsyearcalendarunit |
Nsmonthcalendarunit |
Nsdaycalendarunit |
Nsweekdaycalendarunit |
Nshourcalendarunit |
Nsminutecalendarunit |
Nssecondcalendarunit;
Comps = [Calendar Components:unitflags fromdate:date];
Int week = [comps weekday];
int year=[comps year];
int month = [Comps month];
int day = [Comps day];
NSLog (@ "%@", [NSString stringwithformat:@ "%d years%d months", year,month]);
NSLog (@ "%@", [NSString stringwithformat:@ "%d", day]);
NSLog (@ "%@", [NSString stringwithformat:@ "%@", [Arrweek Objectatindex:week]]);
iOS gets current month day and week