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

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -