Support

Account

Home Forums General Issues Display day in loop with Datepicker Reply To: Display day in loop with Datepicker

  • Hi Eric,

    Your first issue : write month in French it’s not an ACF issue but a PHP one because you use ‘DateTime()‘ an ‘format‘ and this only works in English. If you want to get the month in French you can :

    • Create an array to traduce the month yourself
    • Convert your ‘DateTime()‘ into ‘Timestamp‘ to use ‘strftime‘ and a ‘setlocale()

    For the first solution, the exemple :

    Traduce_Month = array (
         "January" => 'Janvier', 
         "February" => 'Fevrier', 
          ...
    )
    echo '<h4 class="blanc">' .Traduce_Month[$monthKey]. ' ' . $yearKey . '</h4>';

    For the second one you can find all the documentation needed in PHP codex by searching ‘strftime‘ and ‘DateTime::createFromFormat‘ (to convert you date).

    For your second issue (still a PHP issue), to write the event date you just have to get the $date value you saved in your array ‘$group_posts[$year][$month][]‘ and echo it by using ‘$date->format‘ as you already done.

    Hope it’s help