t_machine Posted April 17, 2008 Share Posted April 17, 2008 I have a sql query that already gets the current date using DATE(NOW()) but how can i get the current month instead? Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/101488-how-to-get-current-month-in-mysql/ Share on other sites More sharing options...
ohioman Posted April 17, 2008 Share Posted April 17, 2008 Might you be looking for date("m") Link to comment https://forums.phpfreaks.com/topic/101488-how-to-get-current-month-in-mysql/#findComment-519129 Share on other sites More sharing options...
t_machine Posted April 17, 2008 Author Share Posted April 17, 2008 Thanks for the reply.. I actually want to display results that are within the current month example Select * FROM table_name WHERE date="THIS MONTH"... What can I replace THIS MONTH with to get the results for the current month Thanks for any replies Link to comment https://forums.phpfreaks.com/topic/101488-how-to-get-current-month-in-mysql/#findComment-519138 Share on other sites More sharing options...
PFMaBiSmAd Posted April 17, 2008 Share Posted April 17, 2008 Just use the mysql MONTH() function. It is on the same page in the mysql manual where you found the NOW() and DATE() functions. Link to comment https://forums.phpfreaks.com/topic/101488-how-to-get-current-month-in-mysql/#findComment-519140 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.