quarta-feira, 3 de junho de 2009

Java: get Locale Date String

After struggling with the GregorianCalendar, Date and DateFormat classes for a while, here's a simple wrapper to replace the now deprecated date.getLocalizedString():


  public static String getLocaleDate(Date date, Locale locale) {

    return SimpleDateFormat.getDateInstance(
        SimpleDateFormat.SHORT,locale).format(date).toUpperCase();
  }

Sem comentários:

Enviar um comentário