Browse Source

添加 getHalfEndYm 方法

master
ht 2 years ago
parent
commit
dd12cbf687
1 changed files with 20 additions and 0 deletions
  1. +20
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/DateUtil.java

+ 20
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/DateUtil.java View File

@@ -1185,6 +1185,26 @@ public class DateUtil {
return retStamp;
}

public static String getHalfEndYm(String ymPeriod) {
try {
String year = ymPeriod.substring(0, 4);
String month = ymPeriod.substring(4);
if (month.startsWith("0")) {
int m = Integer.parseInt(month.substring(1));
if (m > 6) {
ymPeriod = year + "12";
} else {
ymPeriod = year + "06";
}
} else {
ymPeriod = year + "12";
}
return ymPeriod;
} catch (Exception e) {
return ymPeriod;
}
}

//获取年月,YYYYMM格式
public static String getDateYm(Date dt) {
String s = simpleDateFormat.get().format(dt);


Loading…
Cancel
Save