Custom Fields
Re-Envisioned
Support General Choose the language of the date field

This topic contains 3 replies, has 2 voices, and was last updated by  Anh Tran 4 months ago.

  • Creator
    Topic
  • #10516

    Benjamin Pichonnaz
    Participant

    Hello, I would like the format of the date is displayed in French and not in English, is it possible?

    rwmb_the_value(rw_date_prochaine_ceremonie, array(‘format’ => ‘j F Y’)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #10535

    Anh Tran
    Keymaster

    Yes, that’s possible. To output the date in a different format, please use this code:

    rwmb_the_value( $field_id, array( 'format' => 'F j, Y' ) );

    #10540

    Benjamin Pichonnaz
    Participant

    Thank you Anh Tran, I misspoke, sorry, I would like to translate the months, not change the format.

    #10570

    Anh Tran
    Keymaster

    I got it. Please use the date_i18n function as follows:

    $date = get_post_meta( get_the_ID(), 'field_id', true );
    echo date_i18n( 'F j, Y', $date );

    For more info, please check this docs.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.