Date date = new Date(); long stamp = date.getTime()/1000; System.out.println(stamp);
long timestamp = System.currentTimeMillis()/1000; System.out.println(timestamp);
Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2020-03-25 15:01:17"); long timestamp = date.getTime()/1000; System.out.println(timestamp);
原文:https://www.cnblogs.com/coder-wf/p/12582791.html