/* 根据一组时间点的list,取距当前最近的时间(已经结束的最近的时间)
时间点的格式为HHmm,例如11点整即1100,下午两点半即1430
*/
public String getNearBeforeTime(List<String> timeList)
{
// 时间点所属的日期
final String ProfDay = "2014-01-02";
Date dateProf = null;
String resultTime = "";
long chaVal = 0;
Date date = new Date();
String hmsStr = "";
String hour;
String minute;
String second;
if (date.getHours() < 10) {
hour = "0" + date.getHours();
} else {
hour = "" + date.getHours();
}
if (date.getMinutes() < 10) {
minute = ":0" + date.getMinutes();
} else {
minute = ":" + date.getMinutes();
}
if (date.getSeconds() < 10) {
second = ":0" + date.getSeconds();
根据多个时间取距当前最近的
最新推荐文章于 2022-06-10 22:20:26 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)