Support

Account

Home Forums Front-end Issues ACF Date Picker (date output) Reply To: ACF Date Picker (date output)

  • You’re not using the correct piece of code. If you want to use date_i18n, you have to set the language of your WordPress to English. This is a WP specific function.

    To use the setlocale method, use this code inside the loop (the setlocale on top is OK):

    // FIRST, SET THE WAY YOU WANT TO FORMAT DATE
    // DETAILS HERE - https://php.net/strftime
    $dateformatstring = "%A le %d %B, %Y";
    
    // THEN, CONVERT THE FIELD FROM ACF TO UNIX TIMESTAMP
    $unixtimestamp = strtotime(get_field('data_picker'));
    
    // NOW ECHO THE ENGLISH DATE USING PHP'S strftime
    echo strftime($dateformatstring, $unixtimestamp);