vendredi 19 avril 2019

Get First day of last month timestamp with Carbon

I want to get the timestamp in milliseconds for first day of last month and last day of last month using Carbon in laravel.

I have tried to do it with carbon::parse, which is achieved. But I want to instantiate the Carbon class simply to achieve the same.

This is the code that works fine with Carbon::parse

Carbon::parse('first day of last month',$timezone)->timestamp

But I want to achieve the same using something like below.

$start = new Carbon('first day of last month');

$end = new Carbon('last day of last month');

The output should be timestamp in milliseconds. Like 1555704794000



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire