简化一些代码。。

This commit is contained in:
jzdayz 2020-01-10 09:46:10 +08:00
parent 0ed8e6f812
commit 6a88ca3539

View File

@ -19,7 +19,6 @@ import org.apache.commons.lang3.time.FastDateFormat;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
/** /**
* Time util * Time util
@ -29,13 +28,12 @@ import java.util.Date;
public class TimeUtils { public class TimeUtils {
public static Timestamp getCurrentTime() { public static Timestamp getCurrentTime() {
Date date = new Date(); return new Timestamp(System.currentTimeMillis());
return new Timestamp(date.getTime());
} }
public static String getCurrentTimeStr() { public static String getCurrentTimeStr() {
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.setTime(new Date()); c.setTimeInMillis(System.currentTimeMillis());
FastDateFormat format = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); FastDateFormat format = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
return format.format(c.getTime()); return format.format(c.getTime());
} }