1

I am trying to test that my Android app formats dates correctly according to locale. For example, I would expect it to show:

"Nov 07" in U.S. (what I see currently) versus "07 Nov" in U.K.

No matter what I do, the date on my device and all apps is always formatted MM/DD and won't change. How can I change the locale so that I can test that different date formats show up properly?

I have tried spoofing my location to U.K. using VPN, and also tried changing:

System > Date & time > Time zone --> to United Kingdom

I am using Pixel 2 device with Android 11.

If it helps, my code:

DateUtils.formatDateTime(context, timestamp.millis(), DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_NO_YEAR or FORMAT_ABBREV_MONTH)
  • Related: [Set Locale programmatically](https://stackoverflow.com/q/4985805/295004) and [Change Locale for Android Studio Emulator](https://stackoverflow.com/q/56639516/295004) but you should explain how you are testing in detail - which device (manufacturer/model)/emulator/OS version, what specific system settings are you changing. – Morrison Chang Nov 02 '22 at 23:11

1 Answers1

0

I was able to change the date format by going to Settings > System > "Languages & input" using this answer: https://stackoverflow.com/a/56639526/18208230