如何将时间戳日期格式转换为dd/mm/yyyy?

How to convert the timestamp date format to dd/mm/yyyy?

我想将此时间戳格式 2021-04-21T17:00:50 转换为“dd/MM/YYYY”

我收到 数字格式异常:

public static final String DATE_FORMAT = "dd-MMM-yyyy";
private String courseStartDate = null;
long longDate = 2021-04-21T17:00:50; 

courseStartDate = getDateTimeFromTimeStamp(longDate, DATE_FORMAT);

public String getDateTimeFromTimeStamp(Long time, String mDateFormat) {
    SimpleDateFormat dateFormat = new SimpleDateFormat(mDateFormat);
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    Date dateTime = new Date(time);
    return dateFormat.format(dateTime);
}
LocalDateTime
.parse( "2021-04-21T17:00:50" )
.format(
    DateTimeFormatter.ofPattern( "dd/MM/uuuu" )
)

这已经讲过很多次了。所以 search to learn more.