I'm trying to show the full current month name in dutch. I've tried it like this:
\Carbon\Carbon::now()->subMonth()->format('F')
But then I see July
so not what I want. My app service
provider looks like this:
public function boot()
{
Carbon::setLocale('nl');
}
Any Idea what I could do to get this to work?
(diffForHumans is working correctly)
$now = Carbon\Carbon::now(); $month = $now->format('m'); Assuming the current month was January, you would receive '01' from that format call. As an aside, if that's all you're using Carbon for in that class, you could just use the default PHP date() method if you feel like using less dependencies.
If you don't want to pull an entire package and want to only install your locale, then you could list the locale installed in your (linux)
server by issuing the command
locale -a
If your locale isn't listed, then you may install your locale nl
using the command
sudo locale-gen nl
sudo update-locale
then the usual setLocale
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With