日期和sql优化

This commit is contained in:
季圣华
2021-06-09 20:29:36 +08:00
parent f04dcd220c
commit 99e7db36d3
30 changed files with 361 additions and 243 deletions

View File

@@ -85,6 +85,14 @@ public class Tools {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
}
public static String parseDayToTime(String day, String timeStr) {
if(StringUtil.isNotEmpty(day)){
return day + timeStr;
} else {
return null;
}
}
/**
* 获得指定时间格式为mm:ss
*
@@ -134,7 +142,7 @@ public class Tools {
/**
* 判断字符串是否全部为数字
*
* @param accountWaste
* @param checkStr
* @return boolean值
*/
public static boolean checkStrIsNum(String checkStr) {
@@ -434,7 +442,7 @@ public class Tools {
/**
* 获取当前日期的前XX个月
*
* @param 之前的第几个月
* @param beforeMonth
* @return 前XX个月字符串
*/
public static String getBeforeMonth(int beforeMonth) {
@@ -443,6 +451,16 @@ public class Tools {
return new SimpleDateFormat("yyyy-MM").format(c.getTime());
}
/**
* 根据月份获取当月第一天
* @param monthTime
* @return
* @throws ParseException
*/
public static String firstDayOfMonth(String monthTime) throws ParseException {
return monthTime + "-01";
}
/**
* 根据月份获取当月最后一天
* @param monthTime
@@ -461,7 +479,7 @@ public class Tools {
/**
* 获取email用户姓名
*
* @param args
* @param emailAddress
*/
public static String getEmailUserName(String emailAddress) {
return emailAddress.substring(0, emailAddress.lastIndexOf("@"));
@@ -470,7 +488,7 @@ public class Tools {
/**
* 获取中文编码,邮件附件乱码问题解决
*
* @param str
* @param emailAttchmentTitle
* @return
*/
public static String getChineseString(String emailAttchmentTitle) {
@@ -501,7 +519,7 @@ public class Tools {
/**
* 模糊判断电话号码是否合法,只能是数字
*
* @param macAddress
* @param userTel
* @return
*/
public static boolean isTelNumberBySlur(String userTel) {