objective c - Going from numerical month to Gregorian name for month -
currently i'm using following code acquire date date picker. right now, when nslog nsdatecomponents var, numberical representation month (i.e. 7 july). how can print out month name, day of week, saturday?
nsdate *selecteddate = _datepicker.date; nsdateformatter *df = [[nsdateformatter alloc] init]; [df setdateformat:@"mm:dd:hh:mm"]; nsdatecomponents *components = [[nscalendar currentcalendar] components:nsdaycalendarunit | nsmonthcalendarunit | nsyearcalendarunit fromdate:_datepicker.date]; nslog(@"components: %@",components);
use format strings eeee
day of week, , mmmm
month of year in nsdateformatter
.
Comments
Post a Comment