I stored data with created datetime(Y-m-d H:i:s) using strtotime function in my database. But now I need to find those stored data by using only year value. How can i do that in php or sql query?
This SQL will return data from 2014 only, assuming you have stored the data in a field with the datetime data type:
SELECT * FROM mytable WHERE datefield >= '20140101' AND datefield < '20150101'
This SQL will return data from 2014 only, assuming you have stored the data in a field with the datetime data type: