Pure Java corner

xiaoxiao2021-03-06  87

Import java.util. *; import com.Unigroup2000.global; import java.io. *; import javax.servlet.http. *; import java.text. *; / ** *

Title: *

description: *

Copyright: Copyright (c) 2004 *

Company: * @Author not attributable * @version 1.0 * /

public class WeekCalendar {public WeekCalendar () throws IOException {} public Calendar CalendarSetTime (String sCurrDate) {Calendar oCalendar = Calendar.getInstance (); Date oDate = new Date (); SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ); If (! Scurdate.equals (") && scurdate! = Null) {Try {ocalendar.settime (SDF.PARSE (SCURRDATE)));} catch (exception ex) {ex.printstacktrace (system.err); System. out.println ( "date format conversion error: =" sCurrDate);}} else oCalendar.setTime (oDate); return oCalendar;} public List Calendar (HttpServletRequest request, HttpServletResponse response, String sCurrDate) {String [] oneWeekDay = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; String loopdate = ", flag =" "; int tent IWeek = 0 iCurRweek = 0; Date Odate = new date (); ocal = calendarsettime (scurdate); // set time iWeek = ocal.get (Calendar.day_of_week) -1; hashmap ohashmap = new hashmap (); string dataset [] = NULL; List dayandw EEK = new arraylist (); for (int i = iWeek; i> 0; i -) {ocal.add (calendar.date, -i); loopdate = ocal.get (calendar.year) "-" (Ocal.get (Calendar.Mont) 1) "-" OCAL.GET (Calendar.date); ocal = calendarsettime (scurdate); // Reset time DataSet = new string [2]; dataset [0] = Loopdate; dataset [1] = oneweekday [(iCurRweek )]; dayandweek.add (dataset);} for (int i = 0; i <7-iWeek; i ) {ocal.add (Calendar.date, i); Loopdate = ocal.get (calendar.year) "

转载请注明原文地址:https://www.9cbs.com/read-106081.html

New Post(0)