日期:2014-05-20 浏览次数:21091 次
<c:set var="datenow" value="<%=new Date()%>"/> ${search.t_time}//插入时间 <c:if test="${datenow}-${search.t_time}<=24"> <img src="Image/new.gif"></c:if>
<c:set var="datenow" value="<%=System.currentTimeMillis()%>" /> ${search.t_time}//插入时间 <c:if test="${datenow}-${search.t_time}<=86400000L"> <img src="Image/new.gif"> </c:if>
------解决方案--------------------
String search_time="20081010"; //按照日期格式加参数,我假设的是yyyyMMdd SimpleDateFormat dateFormat=new SimpleDateFormat("yyyyMMdd"); try { long searchtime=dateFormat.parse(search_time).getTime(); System.out.println(searchtime); } catch (ParseException e) { e.printStackTrace(); }
------解决方案--------------------
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<fmt:formatDate value="${search.t_time}" pattern="yyyy-MM-dd hh:mm:ss" />