Change fmt:formatDate pattern dynamically

625 views Asked by At

I need to change fmt:formatDate pattern dynamically depending on the localization. I have the property file for each locale with the date.format key, somewhere it's value is MM/dd/YYYY, somewhere DD/MM/YYYY and so on. In the JSP I have the following tag:

<fmt:formatDate value="${dateToFormat}" pattern="<spring:message code='date.format' />" var="formattedDate" />

The Exception I get is java.lang.IllegalArgumentException: Illegal pattern character 'p' What's wrong with this code?

1

There are 1 answers

1
rjkernick On BEST ANSWER

Looks like the pattern is not coming in as you expected. Check to see what the spring message for date.format is.