Home Laravel How to get current month data in MySql PHP ?

How to get current month data in MySql PHP ?

by Shahriar Sagor

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.

Example:

SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 MONTH);

Read Also : Laravel chat message module using socket.io and nodejs

Thanks for read. I hope it help you. For more you can follow us on facebook.

close

You may also like