2

I'm using DateFormat.format("EEEE d MMMM", new Date()) ,for arabic it displaying as : الثلاثاء 29 ٥

can anyone tell me how can i get that 29 in the specific locale(which was set) numeral or least how can i ignore the current locale set and display date in English only for all locales.

Vins
  • 4,089
  • 2
  • 35
  • 50
  • 1
    Take a look [here](http://stackoverflow.com/questions/9239937/custom-date-format-in-android-for-given-locale) or [here](http://stackoverflow.com/questions/454315/how-do-you-format-date-and-time-in-android) I believe you will find it very inspiring. – Michal Aug 29 '12 at 11:05

2 Answers2

2

I finally managed to get the date in required format whatever the locale may be,the code goes as:

SimpleDateFormat sf = new SimpleDateFormat("EEEE dd MMMM",new Locale("en"));
textViewID.setText(sf.format(new Date()).toString());

This will display date as

Wednesday 29 August

dont forget to add

import java.text.SimpleDateFormat;

Vins
  • 4,089
  • 2
  • 35
  • 50
-1

Check whether your Locale is supported in Android or not executing the following code.

   for (Locale locale:Locale.getAvailableLocales()) {
        Log.d(locale.getDisplayCountry(),locale.toString()); 
    }
prayagupa
  • 30,204
  • 14
  • 155
  • 192