samedi 3 septembre 2016

Carbon get last 30 days a month ago

Using carbon I'm trying to fetch 30 days starting from one month ago from the date now.

This code fetches the last 30 days from today.

$dt = Period::days(30);

This is how I tried to fetch the last 30 days starting from 1 month ago today.

$dt = Carbon::now()->subMonth();
$date = $dt->Period::days(30);
dd($date);

I'm aware I can't pass the $dt varible to the Period like that but I'm not sure how to grab a period thats offset from the current date/time.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire