(1)境内源IP报表加入对界面时间字段的处理
(2)时间字段的处理放到baseController中 (3)界面ajax函数缩减为1个公用的函数
This commit is contained in:
@@ -243,6 +243,89 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return sdf.parse(date);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isLeapYear(计算是否为闰年)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param years
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static boolean isLeapYear(int years){
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
calendar.set(years,Calendar.DECEMBER,31);
|
||||
if(calendar.get(Calendar.DAY_OF_YEAR)==366){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* setLastDayOfMonth(设置天为月末最后一天)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param cal
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static void setLastDayOfMonth(Calendar cal){
|
||||
switch(cal.get(Calendar.MONTH)){
|
||||
case 0:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 31);
|
||||
break;
|
||||
}
|
||||
case 1:{
|
||||
if(DateUtils.isLeapYear(cal.get(Calendar.YEAR))){
|
||||
cal.set(Calendar.DAY_OF_MONTH, 29);
|
||||
}else{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 28);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 31);
|
||||
break;
|
||||
}
|
||||
case 3:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 30);
|
||||
break;
|
||||
}
|
||||
case 4:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 31);
|
||||
break;
|
||||
}
|
||||
case 5:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 30);
|
||||
break;
|
||||
}
|
||||
case 6:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 31);
|
||||
break;
|
||||
}
|
||||
case 7:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 31);
|
||||
break;
|
||||
}
|
||||
case 8:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 30);
|
||||
break;
|
||||
}
|
||||
case 9:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 31);
|
||||
break;
|
||||
}
|
||||
case 10:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 30);
|
||||
break;
|
||||
}
|
||||
case 11:{
|
||||
cal.set(Calendar.DAY_OF_MONTH, 31);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param args
|
||||
* @throws ParseException
|
||||
|
||||
Reference in New Issue
Block a user