i want to get data inserted in previous week in Laravel 5.1
currently i am using following query:
$AgoDate=\Carbon\Carbon::now()->subWeek()->format('Y-m-d'); // returns 2016-02-03
$NowDate=\Carbon\Carbon::now()->format('Y-m-d'); // returns 2016-02-10
$query->whereBetween('created_on', array($AgoDate,$NowDate));
which returns last 7 days data,
but i need last week's data, means it should return data from (31st Jan to 6th Feb) i.e (Previous Week)
Note: In my case Week starts from Sunday and ends on Saturday
Please help me to sort out this issue.
Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire