Let me see why a mysql Query always fails.
Select * from 'yun _ useitem' where date_format (from_UNIXTIME ('create _ time'), '% Y-% d') = date_format (now (), '% Y-% d ');
In this way, you can check the number of days.
Select * from 'yun _ useitem' where date_format (from_UNIXTIME ('create _ time'), '% Y-% M') = date_format (now (), '% Y-% M ');
That is, you can insert a month without data, and you don't know why there is data in the year of a single query. why is there no data in the month of M?
Reply to discussion (solution)
Are there any differences between your two commands?
Check the data of the current month.
Are there any differences between your two commands?
Check the data of the current month.
The first one I inserted is % Y-% d. This is the data of the day.
Second, I used % Y-% m to query no data for the current month.
Querying % Y also returns the data of the current year. the only data is % Y-% m-$ d and % Y-% m. In this case, no data is returned in the month.
Are there any differences between your two commands?
Check the data of the current month.
It turns out that I have adjusted the local time myself. because I only tested the data for the same month, it is natural that I have no data to query the data in the month. I am also drunk. the local machine was adjusted to the actual data in March. no language added in April