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
mysql 获取当前时间为select now() 运行结果: 2012-09-05 17:24:15 mysql 获取当前时间戳为select unix_timestamp(now()) 运行结果: unix_timestamp(now()) 1346836984 select * from fanwe_payment_notice where user_id=66586 and is_paid=1 and UNIX_TIMESTAMP(pay_date)>=unix_timesta