Laravel coal gets current month in Dutch

I am trying to show the full name of the current month in Dutch. I tried this as follows:

\Carbon\Carbon::now()->subMonth()->format('F')

But then I see July, not what I want. The service of my application provider is as follows:

public function boot()
{
    Carbon::setLocale('nl');
}

Any idea what I can do to get this to work?

(diffForHumans is working correctly)

+4
source share
2 answers

If you do not want to pull out the entire package and only want to install your language, you can specify the locale installed on the server (linux)by issuing the command

locale -a

If your locale is not listed, you can set your language nlusing the command

sudo locale-gen nl
sudo update-locale

then ordinary setLocale

+3

class.intldateformatter.php

$fmt = new IntlDateFormatter(
    'nl_NL',
     IntlDateFormatter::GREGORIAN,
     IntlDateFormatter::NONE
);
echo $fmt->format(mktime(null, null, null, 1, 15, 2014));

// output: 15 januari 2014
+1

Source: https://habr.com/ru/post/1681593/


All Articles