Date Format

Support General Date FormatResolved

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #23553
    pw@grafik-designer-hannover.de[email protected]
    Participant

    Hi, i use Beaver Themer and created Meta Box custom fields with date picker. Unfortunately the date format is in english instead of german. How can i fix this?
    I use this shortcode from Beaver Themer [wpbb post:meta_box field='datum' date_format='d. F Y']. Language setting for the site is DE = German.

    #23560
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You can use the setting js_options to format the date. If you are using the MB Builder, please use the dot notation to apply the setting for the field date. Screenshot https://share.getcloudapp.com/5zud9Jkz.

    It shows in the Beaver editor as well https://share.getcloudapp.com/NQuK7vPL.

    #30681
    AnLipAnLip
    Participant

    Hello Long,

    I am having trouble finding the correct code to change date format to "dd month" AND have the month show in French.

    For the moment I am using this code :

    $meta = rwmb_meta( 'dlc_agenda_date' );

    $meta = get_post_meta( get_the_ID(), 'dlc_agenda_date', true );
    echo date_i18n( 'j F', $meta );

    but it is pulling the actual date (the date it is today, whatever the date), not the value from my meta_key "dlc_agenda_date" as I would like it to...

    Please let me know what I am not doing right...

    #30682
    AnLipAnLip
    Participant

    EDIT : I have found a workaround using Oxygen Builder, using the new Advanced Query function. But I believe some still might want to have a clear example of code applying to changing a date format and ordering query results by meta_key value.

    Thank you if you can take the time

    #30691
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You need to pass the timestamp value type to the second argument of the function date_i18n(). Set 'timestamp' => true when registering the date field.

    Get more details here https://docs.metabox.io/fields/date/#settings

    #36322
    GregGreg
    Participant

    The links to your screenshots are broken. Code should not use screenshots in the first place — 1. for this very reason, and 2. because copy and paste isn't possible — but can you please add it now? If I have [rwmb_meta id="event_date"], which outputs as "2022-02-03 19:00" by default, how do I get it to output as "February 3, 2022"? Thank you.

    #36330
    Long NguyenLong Nguyen
    Moderator

    Hi Greg,

    Here are the screenshots https://imgur.com/a/XtVAbWf
    The date format option works with the Beaver builder as well.

    #36342
    GregGreg
    Participant

    This is what I ended up with: [rwmb_meta id="event_date" format="F j, Y"]

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.