"vscode:/vscode.git/clone" did not exist on "5b1f41fcbe764ab81256fb5aefbab4627e1b1cbd"
Commit 97bbf47f authored by 季圣华's avatar 季圣华
Browse files

优化工具类

parent 825e1c7a
...@@ -155,7 +155,6 @@ public class Tools { ...@@ -155,7 +155,6 @@ public class Tools {
return new SimpleDateFormat("yyyy-MM").format(cal.getTime()); return new SimpleDateFormat("yyyy-MM").format(cal.getTime());
} }
/** /**
* 获取当前月份的前6个月(含当前月) * 获取当前月份的前6个月(含当前月)
* @param size 月数 * @param size 月数
...@@ -176,41 +175,6 @@ public class Tools { ...@@ -176,41 +175,6 @@ public class Tools {
return list; return list;
} }
/**
* 获取当前月份的前6个月(含当前月)
* @param date
* @return
*/
public static List<String> getSixMonth(String date) {
List<String> list = new ArrayList<String>();
int month = Integer.parseInt(date.substring(5, 7));
int year = Integer.parseInt(date.substring(0, 4));
for (int i = 5; i >= 0; i--) {
if (month > 6) {
if (month - i >= 10) {
list.add(year + "-" + String.valueOf(month - i));
} else {
list.add(year + "-0" + String.valueOf(month - i));
}
} else {
if (month - i <= 0) {
if (month - i + 12 >= 10) {
list.add(String.valueOf(year - 1) + "-" + String.valueOf(month - i + 12));
} else {
list.add(String.valueOf(year - 1) + "-0" + String.valueOf(month - i + 12));
}
} else {
if (month - i >= 10) {
list.add(String.valueOf(year) + "-" + String.valueOf(month - i));
} else {
list.add(String.valueOf(year) + "-0" + String.valueOf(month - i));
}
}
}
}
return list;
}
/** /**
* 截取字符串长度 * 截取字符串长度
* *
......
Supports Markdown
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