System类代表系统,系统级的很多属性和控制方法都放置在该类的内部.该类位于java.lang包. currentTimeMillis方法 public static long currentTimeMillis() 该方法的作用是返回当前的计算机时间,时间的表达格式为当前计算机时间和GMT时间(格林威治时间)1970年1月1号0时0分0秒所差的毫秒数. 可以直接把这个方法强制转换成date类型. 代码如下: long currentTime = System.currentTimeMilli
一:各种Date之间的转换方法 public class TimeTest { public static void main(String[] args) { Date date = new Date(); // 一.获取当前系统时间和日期并格式化输出: SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 String dateTime = df.format(date); // For