2012-01-04 11 views
0

は、私は数ヶ月の名前を示すためにしようとしていますが、私のコードは、ちょうど私のような月の数を示しています。3、4、12iOS:どのように月の名前を指定できますか?

[dateFormatter setDateFormat:@"MM"]; 
NSString *currMonth = [dateFormatter stringFromDate:today]; 
month.text = [NSString stringWithFormat:@"%@",currMonth]; 

答えて

4

変更するには、この形式:これに

[dateFormatter setDateFormat:@"MM"]; 

[dateFormatter setDateFormat:@"MMMM"]; 
+0

ありがとう:)うまく動作します –

2

@ Mc.Lover最初にdocumentationを読んでください。その中に平日のシンボルを管理するをチェックしてください。

1

あなたの質問は平日についてです。あなたのコードは約数ヶ月です。混乱。

ドクターからのリンクを追跡すると、unicode formatting documentationになります。

また、最後の行のstringWithFormat:@"%@"は余分です。

[dateFormatter setDateFormat:@"eee"]; 
NSString *weekday = [dateFormatter stringFromDate:today]; 
weekdayField.text = weekday; 
2

質問から月や平日を希望するかどうかは不明ですか?

月:

[dateFormatter setDateFormat:@"MMMM"];` 

平日:

[dateFormatter setDateFormat:@"EEEE"]; 

両方:

[dateFormatter setDateFormat:@"'Weekday:'EEEE 'Month:'MMMM "]; 

私はフォーマットを知る必要があるとき、私は、このリストを参照してください。 http://www.alexcurylo.com/blog/2009/01/29/nsdateformatter-formatting/

関連する問題