1/**
2* <p>
3* Findsunday Method-mainly used. Find Sunday
4* </p>
5* <p>
6* Created by Xiayh creation time 2014-7-21-5:52:58
7* </p>
8* <blockquote>
9* Ten* <ul>
One * <li> Modified Person Modification Time description
A* </ul>
-* </blockquote>
- * @return
the */
-PrivateDate Findsunday (date currentdate) {
-Date CD =NULL;
-intWeekDay = Dateutils.getcurrentdayofweek ();
+Calendar Calendar =NewGregorianCalendar ();
-Calendar.settime (currentdate);
+if(WeekDay >1) {//not Sunday.
A //Find Sunday
atCalendar.add (Calendar. DATE, (8-weekday));//
-cd = Calendar.gettime ();
-}Else{
-//It 's Sunday .
-cd = currentdate;
-}
inreturncd
-}
to
+/**
-* <p>
the* Findmonday Method-mainly used. Find Monday
** </p>
$* <p>
Panax Notoginseng* Created by Xiayh creation time 2014-7-21-10:15:22
-* </p>
the* <blockquote>
+* A* <ul>
the* <li> Modified person Modification Time description
+ * </ul>
-* </blockquote>
$ * @paramcurrentdate
$ * @return
- */
-PrivateDate Findmonday (date currentdate) {
theDate CD =NULL;
-intWeekDay = Dateutils.getcurrentdayofweek ();
WuyiCalendar Calendar =NewGregorianCalendar ();
theCalendar.settime (currentdate);
-if(WeekDay >2) {//not Monday.
Wu //Find Sunday
-Calendar.add (Calendar. date,-(weekDay-2));//
Aboutcd = Calendar.gettime ();
$}Else{
-//It 's Monday .
-cd = currentdate;
-}
AreturnAdy
+}
Java date operation: Find Monday and Sunday