code_junkie

Date display in different locales in Java

Nov 13th, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. DateFormat format = DateFormat.getDateInstance(DateFormat.MEDIUM, theLocaleYouWant);
  2. String text = format.format(new Date());
  3. System.out.println(text);
  4.  
  5. DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
  6.  
  7. Locale locale = new Locale("ru","RU");
  8. DateFormat full = DateFormat.getDateInstance(DateFormat.LONG, locale);
  9. out.println(full.format(new Date()));
Add Comment
Please, Sign In to add comment