I have this code:
<?php 
  echo "'".$sgps_newsletter->getEmail()."' demande en ".date('d.M.Y', strtotime($sgps_newsletter->getCreatedAt())) 
?> 
but the month name is appering in english. What can I do to show it in french? I've change the settings.yml default culture to french, but nothing happens.
A 2022 response:
strftime function has been deprecated since PHP 8.1 (and maybe will be removed on PHP 9)
Try to use this instead:
    $ts = new \DateTime();
    $formatter = new \IntlDateFormatter('fr_FR', \IntlDateFormatter::MEDIUM, \IntlDateFormatter::MEDIUM);
    $formatter->setPattern('d MMM Y');
    echo $formatter->format($ts);
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