月份的名字作为一个字符串作为一个、字符串、名字

由网友(与喜欢撞个满怀)分享简介:我试图返回月份的名称作为一个字符串,如五一,月,月。I'm trying to return the name of the month as a String, for instance "May", "September", "November".我想:int month = c.get(Calendar.M...

我试图返回月份的名称作为一个字符串,如五一,月,月。

I'm trying to return the name of the month as a String, for instance "May", "September", "November".

我想:

int month = c.get(Calendar.MONTH);

不过,这将返回一个整数(5,9,11,分别)。我怎样才能得到月份的名字?

However, this returns integers (5, 9, 11, respectively). How can I get the month name?

推荐答案

使用getDisplayName.

对于早期的API使用的String.Format(Locale.US,%TB,C);

For earlier API's use String.format(Locale.US,"%tB",c);

阅读全文

相关推荐

最新文章