How to fetch previous date data in php mysql

前端 未结 2 894
执笔经年
执笔经年 2021-01-21 23:17

\"enter

I am working on stock project in PHP.Currently while searching according date it i

相关标签:
2条回答
  • 2021-01-21 23:38

    Just tweak your SELECT query:

    SELECT * FROM details WHERE date <= 'your-date-here' ORDER BY date DESC LIMIT 1
    
    0 讨论(0)
  • 2021-01-21 23:44

    You might use something like this

    date('Y-m-d', strtotime("23.12.2015")); // o/p: 2015-12-23
    

    Where 'Y-m-d' format you stored in DB.

    Refer date format here

    0 讨论(0)
提交回复
热议问题