0

In my table, in "created_at" column:

2023-01-03 08:43:40

In my view I am using this code to extract the date:

<span>
   {{ date("F", strtotime($item->created_at)) }} de 
   {{ date("Y", strtotime($item->created_at)) }}
</span>

The result shows:

JANUARY de 2023

Is there a way to extract this month in Brazilian Portuguese?

To show like this:

JANEIRO de 2023

  • 1
    Eloquent timestamps are by default [cast to Carbon objects](https://carbon.nesbot.com/docs/), so you don't need to use strtotime. You can use the carbon methods, which includes [localization](https://carbon.nesbot.com/docs/#api-localization) – aynber Jan 11 '23 at 16:34
  • also don't forget to define your locale and timezone in `config/app.php` – ericmp Jan 11 '23 at 16:39
  • The duplicate has a very good answer using INTL here https://stackoverflow.com/a/66378193/2310830 – RiggsFolly Jan 11 '23 at 16:51

0 Answers0