Hi team,
  I would like to get the day of the week in different locales but the 
getBestDateTimePattern only  show the day of the week in English,  do I 
have something missing in the configuration?

public class MainActivity extends ActionBarActivity {


    private GregorianCalendar mDeadlineCalendar = new GregorianCalendar();


    private SimpleDateFormat getSimpleDateFormat(){
        //String pattern = getBestDateTimePattern(Locale.getDefault(), "MMyd"); 
//short
        //String pattern = getBestDateTimePattern(Locale.getDefault(), 
"MMMyd"); //med
        //String pattern = getBestDateTimePattern(Locale.getDefault(), 
"MMMMyyyyd"); //Long
        //String pattern = getBestDateTimePattern(Locale.getDefault(), 
"MMMMdyhmazzzz"); //other
        //String pattern = getBestDateTimePattern(Locale.getDefault(), 
"EEEEMMMMd"); //other

        String MyLocaleLanguage = "ZH";
        String MyLocaleCountry ="TW";

        String pattern = getBestDateTimePattern(new Locale(MyLocaleLanguage, 
MyLocaleCountry), "EMMMMdyhmazzzz");


        //System.out.println(Locale.getDefault());
        System.out.println(new Locale(MyLocaleLanguage, MyLocaleCountry));

        return new SimpleDateFormat(pattern);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Date date = mDeadlineCalendar.getTime();
        SimpleDateFormat formatDay = getSimpleDateFormat();
        String dateStr = formatDay.format(date);

        Log.d("cmm", dateStr);
        System.out.println(dateStr);
    }


my output is 

09-09 14:36:05.088 5480-5480/com.example.alfredovaldes.myapplication 
I/System.out: zh_TW
09-09 14:36:05.088 5480-5480/com.example.alfredovaldes.myapplication D/cmm: 
2016年9月9日 Fri PM2:36 [GMT+08:00]
09-09 14:36:05.088 5480-5480/com.example.alfredovaldes.myapplication 
I/System.out: 2016年9月9日 Fri PM2:36 [GMT+08:00]


As you can see Fri appears and not the Chinese as seen in the CLDR.

I hope you can help this newbie.


Alfredo

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/9bae07cd-016a-494b-a7ce-c38e79ff572f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to