日期格式修改

This commit is contained in:
jjLv 2026-01-30 09:16:10 +08:00
parent bd1ee7c917
commit cbaa2eb5ba
1 changed files with 4 additions and 4 deletions

View File

@ -37,11 +37,11 @@ public class DateTimeHelper {
}
public static String getTime() {
return format(new Date(), "YYYY-MM-dd HH:mm:ss");
return format(new Date(), "yyyy-MM-dd HH:mm:ss");
}
public static String getNowDate() {
return format(new Date(), "YYYY-MM-dd");
return format(new Date(), "yyyy-MM-dd");
}
public static String getCurrentTimeStr() {
@ -94,12 +94,12 @@ public class DateTimeHelper {
public static int getIntervalDuration(String startTime, String endTime) {
int time = 0;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date1 = simpleDateFormat.parse(startTime);
Date date2 = simpleDateFormat.parse(endTime);
SimpleDateFormat df = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long currentTime = System.currentTimeMillis();
//从对象中拿到时间
long d1 = df.parse(df.format(date1)).getTime();