Today now in this post i will show you how to get current month date in mysql in php . If we need to get all the records of current month by using mysql query. For example we have one table as name “items” and columns are id, title,created_at and also update_at, Now we want to get all records of this month. so now we can fetch the fields value by using DATE_SUB and INTERVAL of mysql. So now in the following example we can see how to select data of current month.
SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 MONTH);
Thanks for read. I hope it help you. For more you can follow us on facebook.