Reputation: 15574
I'm using JSTL to format the Java Date object
to display a date in the format like
September 29, 2015 11:28 AM
I tried below approach ,
<fmt:formatDate pattern="MMMMMMMM d,yyyy HH:mm a" value="${response.date}" />
I wonder how many M
's I need here. I mean I put 8 M s in a wild guess.
Upvotes: 1
Views: 1976
Reputation: 1108802
JSTL <fmt:formatDate>
uses java.text.SimpleDateFormat
under the covers.
So, just read its javadoc how to use the pattern syntax.
Pattern letters are usually repeated, as their number determines the exact presentation:
- Text: For formatting, if the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available.
So, 4 letters as in MMMM
is sufficient to represent the full form.
Upvotes: 3