E ae galera blz???
é o seguinte, tenho o seguinte codigo:
System.out.println
(new SimpleDateFormat("EEEE, d MMMM yyyy").
format(Calendar.getInstance().getTime()));
Ele imprime isto aki, ----> Thursday, 22 December 2011
Alguem sabe como eu passo isso pra portugues???
A principio meu linux esta em ingles e sei que a jvm pega a data corrente do sistema, mas precisava em portugues, alguem sabe???.
Tenta ai!
public static void main(String[] args) {
Locale local = new Locale("PT");
SimpleDateFormat sdf = new SimpleDateFormat("EEEE, d MMMM yyyy", local);
System.out.println
(sdf.format(Calendar.getInstance().getTime()));
}
Essa saída está relacionada ao idioma que a JVM identifica.
Fazendo assim, deve funcionar:
SimpleDateFormat sdf = new SimpleDateFormat("EEEE, d MMMM yyyy", Locale.getAvailableLocales()[61]);
System.out.println
(sdf.format(Calendar.getInstance().getTime()));
Vlw gente…
ambos funcionaram!
cara,
so fazer assim
Locale ptBr = new Locale("pt", "BR");
System.out.println
(new SimpleDateFormat("EEEE, d MMMM yyyy", ptBr).
format(Calendar.getInstance().getTime()));
T+