ios - Formatting an NSDate with Abbreviated Month/Day Names -


if have nsdate object, how can format nsstring output first 3 letters of day (like mon, tue, wed, thu, fri, sat, sun) , first 3 letters of month (jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec)?

currently i'm using nsdateformatter:

        nsdateformatter *dateformatter = [[nsdateformatter alloc]init];         dateformatter.dateformat = @"mmmm dd yyyy";          nsdate *date = ...         nsstring *datestring = [dateformatter stringfromdate:date];          nslog(@"datestring: %@",datestring);         // outputs august 09 2013         // output fri, august 9 

edit

i've tried using nsdatecomponent i'm wondering if there's shortcut getting abbreviations...

nsdatecomponents *components = [[nscalendar currentcalendar] components:nsdaycalendarunit | nsmonthcalendarunit | nsyearcalendarunit fromdate:date]; 

as per link kindly provided rmaddy, @"eee, mmm d"; solution


Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -