1 Reply Latest reply: Jun 24, 2010 5:52 PM by 843810 RSS

    Localized Date format

    843810
      we need to display date in spanish local, for that we are using below code, but the requirment is month of first character has to come in Capital, please don't suggest explicitly convert of first character of string.


      SimpleDateFormat formater = new SimpleDateFormat("dd MMMM yyyy", new Locale("es"));
      TimeZone tz = TimeZone.getTimeZone("Europe/Paris");
      formater.setTimeZone(tz);
      System.out.println("Date = "+formater.format(new Date()));

      Out put
      Date = 27 mayo 2010
        • 1. Re: Localized Date format
          843810
          Vittal,

          As you probably already know the localization is correct. In Spanish, the months of the year are not capitalized.
          You are probably localizing for a US company for US Hispanics.
          You would have to make a custom Locale with a custom resource bundle with translations of months that are capitalized.

          So, just cap the first letter. It is by far the quickest method.

          HTH,
          Eugenio Alvarez