Commit 638e6dcb authored by yanzg's avatar yanzg

接口文档的支持

parent f66593f9
...@@ -17,9 +17,12 @@ import java.util.Date; ...@@ -17,9 +17,12 @@ import java.util.Date;
*/ */
public class DateHelper { public class DateHelper {
private static final String FORMAT_YEAR_STRING = "yyyy-01-01";
private static final String FORMAT_MONTH_STRING = "yyyy-MM-01";
private static final String FORMAT_DAY_STRING = "yyyy-MM-dd"; private static final String FORMAT_DAY_STRING = "yyyy-MM-dd";
private static final String FORMAT_DAY_HOUR_STRING = "yyyy-MM-dd HH:00:00"; private static final String FORMAT_DAY_HOUR_STRING = "yyyy-MM-dd HH:00:00";
private static final String FORMAT_SECOND_STRING = "yyyy-MM-dd HH:mm:ss"; private static final String FORMAT_SECOND_STRING = "yyyy-MM-dd HH:mm:ss";
private static final int MONTH_1 = 1; private static final int MONTH_1 = 1;
private static final int MONTH_2 = 2; private static final int MONTH_2 = 2;
private static final int MONTH_3 = 3; private static final int MONTH_3 = 3;
...@@ -278,9 +281,7 @@ public class DateHelper { ...@@ -278,9 +281,7 @@ public class DateHelper {
* @return 返回的日期 * @return 返回的日期
*/ */
public static Date getMonthStart(Date date) { public static Date getMonthStart(Date date) {
Calendar cal = getDayCalendarBegin(date); return DateHelper.getDateTime( getDate(date, FORMAT_MONTH_STRING));
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
return cal.getTime();
} }
/** /**
...@@ -302,10 +303,7 @@ public class DateHelper { ...@@ -302,10 +303,7 @@ public class DateHelper {
* @return 返回值 * @return 返回值
*/ */
public static Date getYearStart(Date date) { public static Date getYearStart(Date date) {
Calendar cal = Calendar.getInstance(); return DateHelper.getDateTime( getDate(date, FORMAT_YEAR_STRING));
cal.setTime(date);
cal.set(cal.get(Calendar.YEAR), 0, 0, 0, 0, 0);
return cal.getTime();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment