In Javascript, I have this function to display the current date in the header of our page:
<SCRIPT language="Javascript">
var today = new Date();
document.write(today.toLocaleDateString());
</SCRIPT>
I would like to do this through JSTL, but I'm not sure if this is possible. So far, I have this piece of code:
<jsp:useBean id="date" class="java.util.Date" />
<fmt:formatDate value="${date}" type="date" pattern="EEEE, MMMM dd, yyyy"/>
Since the date is now created on the server, it may not represent the date of the client. I believe that I can set the timeZone attribute of the formatDate function, but I'm not sure how to capture the client’s time zone. Can anyone suggest a suggestion?
Thanks!
source
share