公会收入,成员收入增加月榜
(cherry picked from commit 7d03ff0c51d9301e5b71840c3985fd806df94210)
This commit is contained in:
@@ -861,6 +861,58 @@ public class TimeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定年月的第一天
|
||||
* @param ym yyyy-MM
|
||||
* @return
|
||||
*/
|
||||
public static String getFirstDayOfMonth(String ym) {
|
||||
String arr[] = ym.split("-");
|
||||
|
||||
int year = Integer.parseInt(arr[0]);
|
||||
int month = Integer.parseInt(arr[1]);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//设置年份
|
||||
cal.set(Calendar.YEAR, year);
|
||||
|
||||
//设置月份
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
//获取某月最小天数
|
||||
int firstDay = cal.getMinimum(Calendar.DATE);
|
||||
//设置日历中月份的最小天数
|
||||
cal.set(Calendar.DAY_OF_MONTH, firstDay);
|
||||
//格式化日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定年月的最后一天
|
||||
* @param ym
|
||||
* @return
|
||||
*/
|
||||
public static String getLastDayOfMonth(String ym) {
|
||||
String arr[] = ym.split("-");
|
||||
|
||||
int year = Integer.parseInt(arr[0]);
|
||||
int month = Integer.parseInt(arr[1]);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//设置年份
|
||||
cal.set(Calendar.YEAR, year);
|
||||
//设置月份
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
//获取某月最大天数
|
||||
int lastDay = cal.getActualMaximum(Calendar.DATE);
|
||||
//设置日历中月份的最大天数
|
||||
cal.set(Calendar.DAY_OF_MONTH, lastDay);
|
||||
//格式化日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public static boolean getTimeLimit() {
|
||||
|
Reference in New Issue
Block a user