I want to do something like this:
<c:set var="strDate" value="<fmt:formatDate value='${obj.dateIn}' pattern='ddMMyyyy'/>"/>
to obtain the date as (formatted) string and assign it to a variable for later use but it isn't working, any ideas on how to do it in jsp-jstl?
The only way I find around it is to create a "fake" getter for the object java class that outputs the desired date as a String usign SimpleDateFormat.format(..) but me thinks it's not very orthodox and want to leave the underlying classes alone.
<fmt:formatDate value=".." pattern=".." var="strDate" />
the var
attribute is:
Name of the exported scoped variable which stores the formatted result as a String.
First format the date after assign dateFormated to variable
Put it this way:
<fmt:formatDate value='${obj.dateIn}' pattern='ddMMyyyy' var="searchFormated" />
<c:set var="strDate" value="${searchFormated}"/>
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