I have use case in java where we want get the locale specific date. I am using DateFormat.getDateInstance
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM,
Locale.forLanguageTag(locale)));
This translates the dates but ja-JP this translates the date "17 January 2019" to "2019/01/17" but I need something like "2019年1月17日". For all other locales this correctly translates the date.
Please let know if there is other method to get this.
DateFormat
class is notoriously troublesome and fortunately long outdated. Instead useDateTimeFormatter
andLocalDate
, both from java.time, the modern Java date and time API. – Verily