0

I am working with php and mysql,Right now i have following table name "info"

id         name            end_date        end_time
1          abc             2023-02-03      02:02 PM
2          xyz             2023-02-04      10:10 PM 
3          axy             2023-02-01      11:12 PM

now i want to get all records where "datetime"(end_date + end_time) is less than "current time". In other words, my expected output is "1st and 3rd record"

How can i do this ?

user3783243
  • 5,368
  • 5
  • 22
  • 41
jack
  • 9
  • 2
  • 2
    why have you two columns for dataetime? – nbk Feb 04 '23 at 11:11
  • 1
    What have you tried? Why not store a datetime instead of two different columns? – user3783243 Feb 04 '23 at 11:11
  • 1
    Probably `concat` can be used and `cast` but would be best off just storing the data correctly to start with. `where cast(concat(end_date, ' ', concat(substr(end_time, 1, 5), ':00')) as datetime) <= now()`... oh, you'll need to convert `am`/`pm` to 24 hours as well. Really answer is to store data in proper format. – user3783243 Feb 04 '23 at 11:14

0 Answers0