查询日期补全方法

This commit is contained in:
GYJ 2024-12-30 17:55:09 +08:00
parent e0e53bfd9a
commit 7498922675
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package com.sqx.modules.utils;
/**
* @author GYJoker
*/
public class TimeCompleteUtils {
public static String completeStartTime(String startTime) {
if (startTime == null || startTime.isEmpty()) {
return null;
}
if (startTime.contains(" ")) {
return startTime;
}
return startTime + " 00:00:00";
}
public static String completeEndTime(String endTime) {
if (endTime == null || endTime.isEmpty()) {
return null;
}
if (endTime.contains(" ")) {
return endTime;
}
return endTime + " 23:59:59";
}
}