Specify PHP code to select dates and records 3 days old

后端 未结 2 1386
轮回少年
轮回少年 2021-01-28 18:23

I am trying to call data from SQL table that is only 3 days old

My table has a lbs-date column in it and is date format. I have tried the following but get no result fro

相关标签:
2条回答
  • 2021-01-28 19:08
    SELECT *, DATE_FORMAT(lbs_date, '%y,%m,%d') 
    FROM lbs_trace_etrack 
    WHERE lbs_date >= CURDATE() - INTERVAL 3 DAY 
    ORDER BY lbs_date DESC
    
    0 讨论(0)
  • 2021-01-28 19:25

    check DATE_FORMAT. Its syntax is DATE_FORMAT(<date>,format) . Use like this :

    SELECT *, DATE_FORMAT(lbs_date , '%y,%m,%d') FROM lbs_trace_etrack 
    WHERE lbs_date = CURDATE() - INTERVAL 3 DAY 
    ORDER BY lbs_date DESC
    
    0 讨论(0)
提交回复
热议问题