To display date and time in JSTL, the fmt
tag can be utilized. Details can be found here
In order to format the date for use with front end tools like the datatable, a specific date format needs to be specified. By using parameters such as type
or dateStyle
instead of a distinct formatting, a somewhat formatted output can be achieved. However, the issue arises when datatables require knowledge of the precise date format in order to correctly sort these fields.
For example, when utilizing parameters like:
<fmt:formatDate type = "both" dateStyle = "long" timeStyle = "long" value = "${now}" />
The resulting output is:
August 23, 2017 10:52:09 AM UTC
The question then becomes, how can the date output be specifically formatted as:
$.fn.dataTable.moment( 'MMMM dd, YYYY hh:mm:ss aa z' );
In order to achieve accurate sorting results.