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);