How do I get the current time using only JSP? I have no control over the bean, but I want to use the current time ( specifically the hours in 24 hour format ) for a comparison.
I have a bean with a time
${Qlist.beginTime} <---- e.g. 1440 ( 14:40 )
and I would like to check if the current time is greater than that.
Something like this, except I need the current time :
<c:set var="currentTimein24Format" value="1441"/>
<c:if test="${Qlist.beginTime<currentTimein24Format}">
Currently running!
</c:if>
You should have to use <fmt:formatDate>
.
<jsp:useBean id="date" class="java.util.Date"/>
<fmt:formatDate var="time"
value="${date}"
pattern="HHmm"/>
<br/>${time}