Looking for JSTL Taglib calculate seconds between two dates

流过昼夜 提交于 2019-12-23 04:49:10

问题


I'm looking for a taglib to use for calculating how many seconds there was between two dates.


回答1:


You just do that with EL:

<jsp:useBean id="now1" class="java.util.Date" />
<jsp:useBean id="now2" class="java.utli.Date" />
The difference is: ${now1.time/1000) - (now2.time/1000)}

That's just a simple compilable example -- in real life, the two dates would hold different values.



来源:https://stackoverflow.com/questions/5820248/looking-for-jstl-taglib-calculate-seconds-between-two-dates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!