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
