public static String getCurrentTime() {
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
return sdf.format(now);
}
public static long getCurrentTimeMillis() {
return System.currentTimeMillis();
}<Java> 获取当前系统时间
本文介绍了两种获取当前时间的方法:一种是返回格式化的日期字符串,精确到毫秒;另一种是直接返回当前时间的毫秒值。

被折叠的 条评论
为什么被折叠?



