Carbon: Is there a way to get dayOfWeekName( i.e Monday or Tuesday)?

Created on 28 Jul 2015  路  2Comments  路  Source: briannesbitt/Carbon

Problem: I want to display the date in this format "Tuesday, 28 July, 2015".

This can be achieved by below way:

$today = Carbon::today();
$days[$today->dayOfWeek] . ', ' .  $today->toFormattedDateString();

But I need to duplicate the days array from carbon code. Is it possible to directly get the day of week name?

Most helpful comment

Your code snippet doesn't give you your desired format. Following the formats from http://php.net/manual/en/function.date.php you can just use echo Carbon::now()->format('l, d F, Y');.

All 2 comments

Your code snippet doesn't give you your desired format. Following the formats from http://php.net/manual/en/function.date.php you can just use echo Carbon::now()->format('l, d F, Y');.

Thank you! I get desired date format now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joomartin picture joomartin  路  4Comments

hackel picture hackel  路  5Comments

JonoB picture JonoB  路  5Comments

chanux picture chanux  路  5Comments

kylekatarnls picture kylekatarnls  路  5Comments