coupe-r Posted October 26, 2010 Share Posted October 26, 2010 Hi everyone, In the DB, I store dates as date("Y-m-d H:i:s") so it reads "2010-10-25 23:16:06" In a SQL query, I want to query all 2010 dates. I tried, WHERE date_created = '".date("Y")."', but no luck. What goes where date("Y") is? Thanks Link to comment https://forums.phpfreaks.com/topic/216845-quick-date-help/ Share on other sites More sharing options...
Pikachu2000 Posted October 26, 2010 Share Posted October 26, 2010 Do it in the query with MySQL's DATE_FORMAT() function. Link to comment https://forums.phpfreaks.com/topic/216845-quick-date-help/#findComment-1126498 Share on other sites More sharing options...
coupe-r Posted October 26, 2010 Author Share Posted October 26, 2010 Works Perfect, thank you very much. Link to comment https://forums.phpfreaks.com/topic/216845-quick-date-help/#findComment-1126500 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.