java timestamp to date code example
Example 1: java timestamp from string
LocalDateTime timestamp=LocalDateTime.parse("2007-12-03T10:15:30");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd HH:mm");
LocalDate parsedDate = LocalDate.parse("1970 01 01 00:00", formatter);
Example 2: date to timestamp java
All you need to do is change the string within the java.text.SimpleDateFormat constructor to: "MM-dd-yyyy HH:mm:ss".
Just use the appropriate letters to build the above string to match your input date.