I'm a front end programmer that's new to JSTL coding and trying to find out if one date happens before the other.
<fmt:parseDate var="convertedDate" value="${checkDate}" pattern="MM/dd/yyyy" parseLocale="en_US"/>
<c:set var="year2020" value="${<%=new Date("1-1-2019") %>}"
<c:set var="is2019CheckDate" value="${convertedDate < year2020}" />
But this is complaining:
"${<%=new Date("1-2-2019") %>}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${<%=new Date("1-2-2019") %>}]
How can I express the new date in JSTL? Thanks for any helpful tips.
How can I express the new date in JSTL?
Same way you parsed the checkDate
string:
<fmt:parseDate var="year2020" value="1/1/2019" pattern="M/d/yyyy"/>
Though I don't know why the year 2020 starts at the beginning of 2019.