如何在PHP中使用SetLocale功能以获取法语的月份名称



我正在处理PHP代码$formated_date_new = date('M d, Y',strtotime($this_date)); 这给了我英语的月份名称。

<script>
       document.getElementById('title_en').value = "<?php echo $formated_date_new ?>";
</script>

上面的脚本以以下格式返回日期(以英语为单位):

Mar 13, 2019 

要获得法语的月份名称,我需要集成以下代码,但我不确定如何做。

<?php
setlocale(LC_TIME, "fr_FR");
echo strftime(" in French %d.%M.%Y and");


我想要的O/P是:

13 mars 2019

使用strftime而不是日期:

setlocale( LC_TIME, "fr_FR" );
$formated_date_new = strftime( "%d %b %Y", strtotime( $this_date ) );

strftime refernce:

http://php.net/manual/en/function.strftime.php

$formatted_date_new = strftime(" in French %d.%M.%Y and");

我不确定了解您的问题

最新更新