日期工具类bug修改。
This commit is contained in:
parent
af9268a56c
commit
3489fc2470
@ -69,20 +69,18 @@ public class DateUtils{
|
|||||||
Calendar startCalendar = Calendar.getInstance();
|
Calendar startCalendar = Calendar.getInstance();
|
||||||
Calendar endCalendar = Calendar.getInstance();
|
Calendar endCalendar = Calendar.getInstance();
|
||||||
if(quarter == 1) {
|
if(quarter == 1) {
|
||||||
startCalendar.set(year, 1, 1, 00, 00, 00);
|
startCalendar.set(year, 1-1, 1, 00, 00, 00);
|
||||||
endCalendar.set(year, 3,31, 23,59,59);
|
endCalendar.set(year, 3-1,31, 23,59,59);
|
||||||
}else if(quarter == 2) {
|
}else if(quarter == 2) {
|
||||||
startCalendar.set(year, 4, 1, 00, 00, 00);
|
startCalendar.set(year, 4-1, 1, 00, 00, 00);
|
||||||
endCalendar.set(year, 6,30, 23,59,59);
|
endCalendar.set(year, 6-1,30, 23,59,59);
|
||||||
}else if(quarter == 3) {
|
}else if(quarter == 3) {
|
||||||
startCalendar.set(year, 7, 1, 00, 00, 00);
|
startCalendar.set(year, 7-1, 1, 00, 00, 00);
|
||||||
endCalendar.set(year, 9,30, 23,59,59);
|
endCalendar.set(year, 9-1,30, 23,59,59);
|
||||||
}else {
|
}else {
|
||||||
startCalendar.set(year, 10, 1, 00, 00, 00);
|
startCalendar.set(year, 10-1, 1, 00, 00, 00);
|
||||||
endCalendar.set(year, 12,31, 23,59,59);
|
endCalendar.set(year, 12-1,31, 23,59,59);
|
||||||
}
|
}
|
||||||
setMinTime(startCalendar);
|
|
||||||
setMaxTime(endCalendar);
|
|
||||||
return new DateRange(startCalendar.getTime(), endCalendar.getTime());
|
return new DateRange(startCalendar.getTime(), endCalendar.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,5 +209,10 @@ public class DateUtils{
|
|||||||
DateRange lastQuarter = getLastQuarter();
|
DateRange lastQuarter = getLastQuarter();
|
||||||
//System.out.println("上个季度的时间范围: "+DateUtilsTemp.format(lastQuarter.getStart())+" - "+DateUtilsTemp.format(lastQuarter.getEnd()));
|
//System.out.println("上个季度的时间范围: "+DateUtilsTemp.format(lastQuarter.getStart())+" - "+DateUtilsTemp.format(lastQuarter.getEnd()));
|
||||||
|
|
||||||
|
DateRange dateRange = returnQuarterCurrent(2020, 5);
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
System.out.println(df.format(dateRange.getStart()));
|
||||||
|
System.out.println(df.format(dateRange.getEnd()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user