I have a table with participants and their timestamps. I built a filter and wanted to search for the date (e.g. 2021-01-24) in the timestamp, but that doesn’t work because the datas can only be found, when I search with the time included (e.g. 2021-01-24 10:56:46)
So I would like to find a way where I can search for the date and all participants which took part on that specific day show up.
I tried it with the LIKE %xx% command but that didn’t work. And i am new to PHP and really need it for my school project.
Thank you!
Advertisement
Answer
If you’re only wanting to search for dates try the MySQL date()
function like so.
select * from table where date(timestamp_col)=?
This will compare explicitly the date component of the timestamp rather than the full timestamp.