Issue
I want to keep date format to fix standard regardless of locale. But however it is by default taking current locale and setting format based on locale.
th:text="${#dates.format(myDate, 'dd-MMM-yyyy')}"
I am always expecting format be like
09-Sep-2015
but with CA
locale I am getting 09-de set.-2015
Is there a way to fix this.
UPDATE This question is not duplicate of This question. My problem is related to locale formatting.
Solution
Not sure you are using Maven
or Gradle
. Add thymeleaf-extras-java8time
as your dependency.
and instead of #dates
use #temporal
and specify locale
as parameters as below.
th:text="${#temporals.format(myDate, 'dd-MMM-yyyy','en')}"
But make sure your myDate
is in java.time.*
format
Answered By - user9735824
Answer Checked By - Cary Denson (JavaFixing Admin)