I am using SimpleDateFormat to format my date "dd Mmm yyy" format but I want Mmm to be translated to Malay. I am using below code to do so but unable to get the expected result.
SimpleDateFormat sdf = new SimpleDateFormat(format,new Locale("ms","MY"));
return sdf.format(date);
You Should Try This Way to format locale date:
DateFormat f = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault());
String formattedDate = f.format(new Date());
System.out.println("Date: " + formattedDate);
I Hope this will work. Reference link: Localized date format in Java
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