Commit b2f565e3 authored by neo's avatar neo

[BUGFIX] fixed dateutil get period start and end

parent 2d52fc08
......@@ -534,17 +534,19 @@ public class DateUtils {
}
public static String getPeriodBegin(int year, int period) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.set(year, period - 1, 1, 0, 0, 0);
return sdf.format(calendar.getTime());
}
public static String getPeriodEnd(int year, int period) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.set(year, period - 1, -1, 23, 59, 59);
if (period < 12)
calendar.set(year, period, -1, 23, 59, 59);
else if (period == 12)
calendar.set(year, period - 1, 31, 23, 59, 59);
return sdf.format(calendar.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