public static void main(String[] args) {
long time = System.currentTimeMillis();
System.out.println(time);
}
输出:1508505474970
获取当前系统时间:
public static void main(String[] args) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println(df.format(new Date())); }
输出:2017-10-20 21:19:15