mardi 27 décembre 2016

Convert month name to string number using Carbon?

When i use this code, when language is English for example for December i get $date_number = 12, but when i use German i get for Dezember $date_number= 01. Thats way i think that i need to use Carbon to convert month name to string number of month, so that i can use localization. Any suggestion how can i fix that?

$date_number = strval(date('m', strtotime($month)));

  $articles = Articles::whereRaw('MONTH(created_at) ='.$date_number)->where('approved',1)->get();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2i2OjsS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire