Get current time
NSDate *now = [NSDate Date];
NSLog (@ "Now date was:%@", now);
04
Nscalendar *calendar = [Nscalendar Currentcalendar];
Nsuinteger unitflags = Nsyearcalendarunit | Nsmonthcalendarunit | Nsdaycalendarunit | Nshourcalendarunit | Nsminutecalendarunit | Nssecondcalendarunit;
nsdatecomponents *datecomponent = [Calendar components:unitflags Fromdate:now];
08
datecomponent int year = [the year];
Ten int month = [datecomponent month];
one int day = [Datecomponent day];
hour int = [Datecomponent hour];
int minute = [datecomponent minute];
second int = [datecomponent second];
15
NSLog (@ "Year was:%d", year);
NSLog (@ "Month is:%d", month);
NSLog (@ "Day was:%d", day);
NSLog (@ "Hour is:%d", hour);
NSLog (@ "Minute is:%d", minute);
NSLog (@ "Second is:%d", second);
Ios-gets the year, month, day, hour, minute, and second of the current time