First you have to add formatting tag lib into your project.
put <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/formatting"%> on the top of your JSP.
Say you have date string in a variable dateStr. Then to make date object out of it you have to write following code.
This will parse the given date string with the given pattern and create java.util.Date object. you can access the date object with the variable name you have provided in var attribute.
If you want to format the date object then you can use formatDate tag.
note: For pattern string please check java website.
You can also use var attribute to store formatted string into variable.
No comments:
Post a Comment