How to fetch this week records in MySql ?By Hardik Savani | February 28, 2016 | | 849 Viewer | Category : PHP MySql
Share this post:
If you require to get all the records of current week using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this week. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current week.
SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 WEEK);
- How to generate slug using str_slug() helper in Laravel 5?
- Bootstrap year picker example using datepicker js
- How to add multiple markers in google map
- How to send mail using Sendgrid in laravel 5?
- Autocomplete with images and custom html code in Jquery UI?
- How to get latitude longitude from mysql in laravel 5?
- How to add tooltip Bootstrap?
- Laravel 5.3 - How to create SEO friendly sluggable URL