|
@@ -185,10 +185,10 @@ public final class DateUtils {
|
|
|
calendar.set(Calendar.SECOND, 0);
|
|
calendar.set(Calendar.SECOND, 0);
|
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
|
|
|
|
|
|
- return calendar.getTimeInMillis() / 1000;
|
|
|
|
|
|
|
+ return calendar.getTimeInMillis();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
- return date.getTime() / 1000;
|
|
|
|
|
|
|
+ return date.getTime();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -198,7 +198,7 @@ public final class DateUtils {
|
|
|
// 设置时区为UTC(你可以根据需要更改时区)
|
|
// 设置时区为UTC(你可以根据需要更改时区)
|
|
|
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
// 将时间戳转换为毫秒并设置时间
|
|
// 将时间戳转换为毫秒并设置时间
|
|
|
- calendar.setTimeInMillis(timestamp * 1000L);
|
|
|
|
|
|
|
+ calendar.setTimeInMillis(timestamp);
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
calendar.set(Calendar.MINUTE, 0);
|
|
calendar.set(Calendar.MINUTE, 0);
|
|
|
calendar.set(Calendar.SECOND, 0);
|
|
calendar.set(Calendar.SECOND, 0);
|
|
@@ -224,10 +224,10 @@ public final class DateUtils {
|
|
|
calendar.set(Calendar.SECOND, 59);
|
|
calendar.set(Calendar.SECOND, 59);
|
|
|
calendar.set(Calendar.MILLISECOND, 999);
|
|
calendar.set(Calendar.MILLISECOND, 999);
|
|
|
|
|
|
|
|
- return calendar.getTimeInMillis() / 1000;
|
|
|
|
|
|
|
+ return calendar.getTimeInMillis();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
- return date.getTime() / 1000;
|
|
|
|
|
|
|
+ return date.getTime();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -236,7 +236,7 @@ public final class DateUtils {
|
|
|
// 设置时区为UTC(你可以根据需要更改时区)
|
|
// 设置时区为UTC(你可以根据需要更改时区)
|
|
|
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
// 将时间戳转换为毫秒并设置时间
|
|
// 将时间戳转换为毫秒并设置时间
|
|
|
- calendar.setTimeInMillis(timestamp * 1000L);
|
|
|
|
|
|
|
+ calendar.setTimeInMillis(timestamp);
|
|
|
// 获取小时
|
|
// 获取小时
|
|
|
return calendar.get(Calendar.HOUR_OF_DAY);
|
|
return calendar.get(Calendar.HOUR_OF_DAY);
|
|
|
}
|
|
}
|
|
@@ -246,7 +246,7 @@ public final class DateUtils {
|
|
|
// 设置时区为UTC(你可以根据需要更改时区)
|
|
// 设置时区为UTC(你可以根据需要更改时区)
|
|
|
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
// 将时间戳转换为毫秒并设置时间
|
|
// 将时间戳转换为毫秒并设置时间
|
|
|
- calendar.setTimeInMillis(timestamp * 1000L);
|
|
|
|
|
|
|
+ calendar.setTimeInMillis(timestamp);
|
|
|
// 获取小时
|
|
// 获取小时
|
|
|
return calendar.get(Calendar.MINUTE);
|
|
return calendar.get(Calendar.MINUTE);
|
|
|
}
|
|
}
|
|
@@ -279,7 +279,7 @@ public final class DateUtils {
|
|
|
calendar.set(Calendar.SECOND, 0);
|
|
calendar.set(Calendar.SECOND, 0);
|
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, -days);
|
|
calendar.add(Calendar.DAY_OF_MONTH, -days);
|
|
|
- return calendar.getTime().getTime() / 1000;
|
|
|
|
|
|
|
+ return calendar.getTime().getTime();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static String getBeforeDayStr(String dateStr, String format, int days) {
|
|
public static String getBeforeDayStr(String dateStr, String format, int days) {
|