Answer the question
In order to leave comments, you need to log in
Format date?
You need to get a string like "September 2012", "December 2012" and so on from the date.
What I did: I set the Russian locale, I try to format according to the pattern "MMMM yyyy", it gives out "September 2012", i.e. in the genitive case, but in the nominative case. I don't want to deal with arrays and string concatenation.
Googling suggested that others have the opposite problem: the month is displayed in the nominative case, but they need it in the genitive. It just baffled me.
Maybe you can slip your own array of month names into the formatter?
UPD: code
Locale locale = new Locale("ru");
Locale.setDefault(locale);
SimpleDateFormat MONTH_DF = new SimpleDateFormat("MMMM yyyy");
Date date = new Date();
((TextView) view.findViewById(R.id.statements_item_date)).setText(MONTH_DF.format(date));
Answer the question
In order to leave comments, you need to log in
About where the roots of your problem are already noted above: SimpleDateFormat is part of the standard library, and its behavior depends on the vendor.
But in general, working with dates in the standard library is terrible: take only the fact that SDF is not thread-safe. Use Joda Time , Luke! It is much more convenient to work with this library, it is more powerful, without wild bugs and is constantly evolving, unlike.
Well, show me some code.
Maybe you can slip your own array of month names into the formatter?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question