0

In my android app, I have successfully implemented the language change part.

The problem is, the DateTime locale is based on the device locale but not the in app locale, for example, when I switch in app locale from English to Germany, while the device locale is English

The string / draw-able etc are obtained from my Germany string folder, but the date remains in the English one e.g. JAN , FEB , etc...

And here is my code to get the month

DateFormatSymbols.getInstance().getShortMonths()[position]

Also , the way to display date

String relativeString = getRelativeDateTimeString (this, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS,DateUtils.WEEK_IN_MILLIS, 0));

How to fix that? Thanks

Hungry Coder
  • 1,800
  • 17
  • 22
user3538235
  • 1,991
  • 6
  • 27
  • 55

1 Answers1

0

how to get date in locale this solution is

 DateFormat formatter;
 formatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, new Locale("de", "DE"));
 String result = formatter.format(new Date());

from this you get get idea and get help and if you stuck than fill free to ask me :)

i have refer

  1. DateFormat
  2. DateFormat example
MilapTank
  • 9,988
  • 7
  • 38
  • 53