84 跳转房间 taskid=null,fix bugs.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.xscm.moduleutil.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
@@ -258,6 +260,25 @@ public class TimeUtils {
|
||||
return "1天"; // 或者 return "0天";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算时间差值并向上取整为天数
|
||||
* @param currentTimeMillis 当前时间(毫秒级时间戳)
|
||||
* @param createTimeSecond 创建时间(秒级时间戳)
|
||||
* @return 向上取整后的天数
|
||||
*/
|
||||
public static int calculateDays(long currentTimeMillis, long createTimeSecond) {
|
||||
// 1. 计算时间差(毫秒)
|
||||
long timeDiffMillis = currentTimeMillis - createTimeSecond;
|
||||
|
||||
// 2. 转换为天数(1天 = 24*60*60*1000 毫秒)
|
||||
BigDecimal daysDecimal = new BigDecimal(timeDiffMillis)
|
||||
.divide(new BigDecimal(24 * 60 * 60 * 1000), 10, RoundingMode.HALF_UP);
|
||||
|
||||
// 3. 向上取整(即使是 8.0001 天也会变成 9 天)
|
||||
return daysDecimal.setScale(0, RoundingMode.CEILING).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据生日字符串计算年龄
|
||||
* @param birthDay 生日字符串,格式为 "yyyy-MM-dd"
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.59" />
|
||||
app:layout_constraintGuide_percent="0.62" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_frame_bg"
|
||||
|
||||
Reference in New Issue
Block a user