import java.util.Date;
import java.text.SimpleDateFormat;
public class TimestampConverter {
public static void main(String[] args) {
long timestamp = 1612345678901L;
Date date = new Date(timestamp);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formattedDateTime = sdf.format(date);
System.out.println(formattedDateTime);
}
}
标签:Java,MM,dd,SimpleDateFormat,yyyy,Date
From: https://www.cnblogs.com/Twittery/p/17797972.html