PHP date - get name of the months in local language

后端 未结 5 1617
礼貌的吻别
礼貌的吻别 2020-12-11 00:46

I have this part of the function, which gives me name of the months in English. How can I translate them to my local language (Serbian)?

$month_name = date(\         


        
5条回答
  •  借酒劲吻你
    2020-12-11 01:14

    Here is an example with IntlDateFormatter

    $format = new IntlDateFormatter('sr_CS', IntlDateFormatter::NONE, 
                  IntlDateFormatter::NONE, NULL, NULL, "MMM");
    $monthName = datefmt_format($format, mktime(0, 0, 0, $i));
    

提交回复
热议问题