MySQL毫秒值和日期转换,MYSQL内置函数FROM_UNIXTIME: select FROM_UNIXTIME(t.createDate/1000,'%Y-%m-%d %h:%i:%s') as cd from task t where taskStatus='1'; SELECT FROM_UNIXTIME(time/1000,'%Y-%m-%d %h:%i:%s') FROM `logs` where time='1541260863000'; //t.createDate里是lon
public static void main(String[] args) { String time = System.currentTimeMillis();//获取当前时间精确到毫秒级的时间戳,例:1525849325942 System.out.println(timeStamp2Date(time)) } public static String timeStamp2Date(String time) { Long timeLong = Long.parseLong(time); S