|
@@ -71,6 +71,20 @@ public class DateFunc {
|
|
|
return new SimpleDateFormat("yyyy-MM-dd").format(time);
|
|
return new SimpleDateFormat("yyyy-MM-dd").format(time);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static String getTomorrow() {
|
|
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
|
|
+ cal.add(Calendar.DATE, 1);
|
|
|
|
|
+ Date time = cal.getTime();
|
|
|
|
|
+ return new SimpleDateFormat("yyyy-MM-dd").format(time);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getAfterTomorrow() {
|
|
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
|
|
+ cal.add(Calendar.DATE, 2);
|
|
|
|
|
+ Date time = cal.getTime();
|
|
|
|
|
+ return new SimpleDateFormat("yyyy-MM-dd").format(time);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static String getYesterdayStart() {
|
|
public static String getYesterdayStart() {
|
|
|
return getYesterday()+" 00:00:00";
|
|
return getYesterday()+" 00:00:00";
|
|
|
}
|
|
}
|
|
@@ -79,6 +93,22 @@ public class DateFunc {
|
|
|
return getYesterday()+" 23:59:59";
|
|
return getYesterday()+" 23:59:59";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static String getTomorrowStart() {
|
|
|
|
|
+ return getTomorrow()+" 00:00:00";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getTomorrowEnd() {
|
|
|
|
|
+ return getTomorrow()+" 23:59:59";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getAfterTomorrowStart() {
|
|
|
|
|
+ return getAfterTomorrow()+" 00:00:00";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getAfterTomorrowEnd() {
|
|
|
|
|
+ return getAfterTomorrow()+" 23:59:59";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取次日开始时刻
|
|
* 获取次日开始时刻
|
|
|
**/
|
|
**/
|
|
@@ -120,7 +150,7 @@ public class DateFunc {
|
|
|
/**
|
|
/**
|
|
|
* 获取上周的开始时刻
|
|
* 获取上周的开始时刻
|
|
|
*/
|
|
*/
|
|
|
- public static String getPreWeekStart() {
|
|
|
|
|
|
|
+ public static String getLastWeekStart() {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
Calendar cal = Calendar.getInstance();
|
|
|
//如果当天为周日,则转为上一周的周日
|
|
//如果当天为周日,则转为上一周的周日
|
|
|
if (cal.get(Calendar.DAY_OF_WEEK) == cal.getActualMinimum(Calendar.DAY_OF_WEEK)) {
|
|
if (cal.get(Calendar.DAY_OF_WEEK) == cal.getActualMinimum(Calendar.DAY_OF_WEEK)) {
|
|
@@ -136,7 +166,7 @@ public class DateFunc {
|
|
|
/**
|
|
/**
|
|
|
* 获取上周结束的时刻
|
|
* 获取上周结束的时刻
|
|
|
**/
|
|
**/
|
|
|
- public static String getPreWeekEnd() {
|
|
|
|
|
|
|
+ public static String getLastWeekEnd() {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
Calendar cal = Calendar.getInstance();
|
|
|
//如果当天为非周日,则为下一周的周日
|
|
//如果当天为非周日,则为下一周的周日
|
|
|
if (cal.get(Calendar.DAY_OF_WEEK) != cal.getActualMinimum(Calendar.DAY_OF_WEEK)) {
|
|
if (cal.get(Calendar.DAY_OF_WEEK) != cal.getActualMinimum(Calendar.DAY_OF_WEEK)) {
|
|
@@ -151,7 +181,7 @@ public class DateFunc {
|
|
|
/**
|
|
/**
|
|
|
* 获取上月月开始时刻
|
|
* 获取上月月开始时刻
|
|
|
**/
|
|
**/
|
|
|
- public static String getPreMonthStart() {
|
|
|
|
|
|
|
+ public static String getLastMonthStart() {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
Calendar cal = Calendar.getInstance();
|
|
|
cal.add(Calendar.MONTH, -1);
|
|
cal.add(Calendar.MONTH, -1);
|
|
|
cal.set(Calendar.DAY_OF_MONTH, 1);
|
|
cal.set(Calendar.DAY_OF_MONTH, 1);
|
|
@@ -162,7 +192,7 @@ public class DateFunc {
|
|
|
/**
|
|
/**
|
|
|
* 获取上月最后时刻
|
|
* 获取上月最后时刻
|
|
|
**/
|
|
**/
|
|
|
- public static String getPreMonthEnd() {
|
|
|
|
|
|
|
+ public static String getLastMonthEnd() {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
Calendar cal = Calendar.getInstance();
|
|
|
cal.add(Calendar.MONTH, -1);
|
|
cal.add(Calendar.MONTH, -1);
|
|
|
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
|
|
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
|