import java.time.*;
import java.time.format.*;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String input = "2021-02-05 13:07:35";
LocalDateTime datetime = LocalDateTime.parse(input, formatter);
private String getDate(long time) {
Calendar cal = Calendar.getInstance(Locale.ENGLISH);
cal.setTimeInMillis(time * 1000);
String date = DateFormat.format("dd-MM-yyyy", cal).toString();
return date;
}