ALI ISMAEEL
ALI ISMAEEL

Reputation: 115

Change the date format using Carbon - Laravel

I have a date in my database which is 2018-05-21 00:00:00.00000 I would like to get the name of the month , I am trying to make the date as a carbon format (not sure if it is not) with this code

    `$timestemp = Carbon::create('Y-m-d H:i:s', $timestamp)->toFormattedDateString();`

and I am getting this error

Unexpected data found. Trailing data

If anyone have an alternative solution or know a fix for the issue please help me.

Upvotes: 0

Views: 1178

Answers (1)

Prashant Prajapati
Prashant Prajapati

Reputation: 1015

If you want to get the name of month try using below code

$timestemp = Carbon::parse($timestamp)->format('F');

Upvotes: 0

Related Questions