Converting java date object to milliseconds in JSTL

date, java, jstl

Solution

Just invoke `Date#getTime()`.

<p>The date property of a bean in milliseconds: ${bean.date.time}</p>

JSTL is not necessary in this context, unless you're running a prehistoric JSP 1.x beast, then you'd need to display it using `<c:out>` as EL in template text was not supported back then.

Problem

How can I convert a java date to milliseconds in JSTL? I tried using `<fmt:formatDate/>` but with no success. Please let me know any way to achieve this.

Original source