Home > front end >  The JSP page how to iterate over a period of time every day
The JSP page how to iterate over a period of time every day

Time:01-08

From the background start date and end date, in the JSP interface traverse the interval of every day, and then dynamically add div, div to store the current traversal of date, and bosses to help how to write
 
Send it//string format is: the 2020-01-01 such
Var begin_date=& lt; S: property value="https://bbs.csdn.net/topics/begin_date" & gt; ;
Var end_date=& lt; S: property value="https://bbs.csdn.net/topics/end_date" & gt; ;

CodePudding user response:

Write a JSP code
For example
 & lt; % 
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
Calendar bDate=Calendar. GetInstance ();
Calendar eDate=Calendar. GetInstance ();
BDate. SetTime (SDF. Parse (begin_date));
EDate. SetTime (SDF. Parse (end_date));
While (bDate. Before (eDate)) {
Out. The printf (" & lt; Div> % s
" The SDF. The format (bDate));
BDate. Add (Calendar DATE, 1);
}
%>
  • Related