IPhone localization — inducing date?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
15 views
Good time of day.


Faced with the problem — NSDateFormatter doesn't know how to persuade the dates (and why would he be able to, right?). That is, if I tell him the format of the form "MMMM yyyy", then the output is "January 2011". What are the solutions? And, Yes, I do not want to make the code language dependent, so the option of NSDictionary<Jan> Jan> I would like to consider last.
by | 15 views

5 Answers

0 like 0 dislike
NSDateFormatter *mf = [[[NSDateFormatter alloc] init] autorelease];
NSArray *months = [mf standaloneMonthSymbols];
\r

\r
In the array of months — names of the months as "January, February, ..." depending on the current locale.
by
0 like 0 dislike
See method 'dateFormatFromTemplate:options:locale:' DateFormatter'and
\r
NSString *format = [NSDateFormatter dateFormatFromTemplate:@"MMMMyyyy" options:0 locale:[NSLocale currentLocale]]
NSString *dateString = [aDateFormatter stringFromDate:aDate];
\r
In General, for stand-alone names (ie no cases) is the symbol L (http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns)
by
0 like 0 dislike
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"LLLL"]; //September
by
0 like 0 dislike
If you do not want to implement dependent language mechanisms that represent the dates as numbers for day, month and year. The only thing that must be taken into account in the settings of your application in this case is the order of day-month-year and month-day-year.
by
0 like 0 dislike
It looks like the standard iOS no solution.
It is strange that Apple did not think to do as Microsoft .NET where month format depends on the presence of line numbers, that is
'd MMMM yyyy' produces 'January 12 2011', and
'MMMM yyyy' produces 'January 2011'
by
110,608 questions
257,186 answers
0 comments
28,042 users