手机验证码登录修改

This commit is contained in:
haozq 2025-09-10 15:24:06 +08:00
parent 753ab48794
commit 4ec055a481
1 changed files with 18 additions and 0 deletions

View File

@ -152,6 +152,24 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
return days + separator + hours + separator + minutes;
}
public static String timeDistance(Date endDate, Date startTime)
{
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - startTime.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "" + hour + "小时" + min + "分钟";
}
/**
* LocalDateTime 转换为 Date