common里DateUtils 添加 isEffectiveDate 判断是否是当前日期方法
This commit is contained in:
@@ -580,6 +580,29 @@ public class DateUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否等于当前日期
|
||||
*
|
||||
* @param nowTime 传入需要判断的日期
|
||||
* @return
|
||||
*/
|
||||
public static boolean isEffectiveDate(Date nowTime) {
|
||||
|
||||
// 格式转换
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String nowDateTime = simpleDateFormat.format(nowTime);
|
||||
String newDateTime = simpleDateFormat.format(new Date());
|
||||
|
||||
// 判断传入日期(nowDateTime)是否等于当前日期(newDateTime)
|
||||
if (nowDateTime.equals(newDateTime)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static final String parseDateToStr(final String format, final Date date) {
|
||||
return new SimpleDateFormat(format).format(date);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user