Simple DateFormat:
<%@ page language="java" import="java.text.DateFormat, java.text.SimpleDateFormat, java.util.Calendar" errorPage="" %>
<%
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
Calendar calendar = Calendar.getInstance();
String currDate = df.format(calendar.getTime());
calendar.add(Calendar.DATE, -7);
String prevDate = df.format(calendar.getTime());
%>
Previous Date IS: <%=prevDate%>"/> <br>
Current Date Is: <%=currDate%>"/>
No comments:
Post a Comment