1、獲取當前時間戳兩種方法:
System.currentTimeMillis(); #1536764057392 微秒
new Date().getTime(); #1536764057392 微秒
2、時間戳轉化為yyyyMMdd格式時間
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
String date_1 = df.format(System.currentTimeMillis()); # 20180912 22:54:17
String date_2 = df.format(new Date().getTime()); # 20180912 22:54:17
3、yyyyMMdd HH:mm:ss 格式時間轉化為時間戳
String date_1 = "20180910 22:58:10";
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
System.out.println(String.valueOf(df.parse(date_1).getTime())); #1536591490000 微秒