Jsp 如何在jstl的时间戳中添加30天
我需要在时间戳中为当前系统日期添加30天。我怎么能做到呢?我有以下代码:Jsp 如何在jstl的时间戳中添加30天,jsp,jstl,Jsp,Jstl,我需要在时间戳中为当前系统日期添加30天。我怎么能做到呢?我有以下代码: <% Date date= new Date(); long time = date.getTime(); Timestamp ts = new Timestamp(time); %> <c:set var="currentDate"><%=ts%></c:set> <c:if test="${startDate l
<%
Date date= new Date();
long time = date.getTime();
Timestamp ts = new Timestamp(time);
%>
<c:set var="currentDate"><%=ts%></c:set>
<c:if test="${startDate lt currentDate}">
<c:if test="${endDate gt currentDate}">
我怎样才能使ts+30?提前感谢。使用日历:
Calendar cal=new GregorianCalendar();
cal.add(Calendar.DATE, 30);
Date d=cal.getTime();
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
Date date= new Date();
Calendar cal = Calendar.getInstance();
cal.setTime (date);
cal.add (Calendar.DATE, 30);
date = cal.getTime ();
%>
<c:set var="currentDate"><%=date%></c:set>
<c:out value="currentDate"/>