Question : Get Current date in MM/dd/YYYY format using JSTL

Hi Folks,

Currently I am getting the current date on the JSP using the java code as follows:

<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>


<%
SimpleDateFormat sdf=new SimpleDateFormat("MM/dd/yyyy");
String formatteddate=sdf.format(new Date());
%>
My current date is<%=formatteddate%>

This is not accepted as the JSP code should be pure presentation work. I suppose JSTL will be a great option.
The fmt TAG works for formatting time. Can it be used to get the current date.
Is there a way to simulate the above JAVA code using JSTL tag?

Regards,
Sanmath


Answer : Get Current date in MM/dd/YYYY format using JSTL

Hello sanmath-

if you are using the fmt-rt.tld you can use


else if you are using the jstl expression language (fmt.tld) use


Hope this helps you out!
Random Solutions  
 
programming4us programming4us