I'm trying to get a date string with the shortened form of the day of week and month, in addition to the day of month.
For example, a user with an English locale would see:
Tue Jun 17
and a user with a German locale would see:
Di. 17 Juni
I've been looking at the android.text.format.DateFormat docs and the getBestDateTimePattern(Locale locale, String skeleton) looked like it might work, but it requires API 18+, so I can't use it.
Is there a way to get this kind of short format that is based on the user's current locale?
Okay, I think I finally figured this out:
int flags = DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_NO_YEAR |
DateUtils.FORMAT_ABBREV_ALL |
DateUtils.FORMAT_SHOW_WEEKDAY;
dateTextView.setText(DateUtils.formatDateTime(this, millis, flags));
For an English locale, you get:
Wed, Jun 18
and for a German locale, you get:
Mi., 18. Juni
and for a French locale, you get:
mer. 18 juin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With