Given a java.util.Date, what’s the best way to display the date as Today rather than in some version of dd/mm/yyyy in a JSP?
Given a future date, I’d still like it to display in a dd/mm/yyyy format, but today should present as Today.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The proper JSP/JSTL way would be using JSTL
<fmt:formatDate>. You can use<jsp:useBean>to construct and put ajava.util.Datein the page scope.Note that I fixed
mmto beMM. Themmstands for minutes,MMfor months. See alsoSimpleDateFormatjavadoc.