Date Format
- This topic has 7 replies, 4 voices, and was last updated 3 years, 6 months ago by
Greg.
-
AuthorPosts
-
December 15, 2020 at 11:25 PM #23553
[email protected]
ParticipantHi, 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.December 16, 2020 at 6:51 AM #23560Long Nguyen
ModeratorHi,
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.
September 9, 2021 at 6:29 PM #30681AnLip
ParticipantHello 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...
September 9, 2021 at 8:09 PM #30682AnLip
ParticipantEDIT : 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
September 10, 2021 at 12:46 PM #30691Long Nguyen
ModeratorHi,
You need to pass the
timestampvalue type to the second argument of the function date_i18n(). Set'timestamp' => truewhen registering the date field.Get more details here https://docs.metabox.io/fields/date/#settings
June 3, 2022 at 10:33 PM #36322Greg
ParticipantThe 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.June 6, 2022 at 5:42 AM #36330Long Nguyen
ModeratorHi Greg,
Here are the screenshots https://imgur.com/a/XtVAbWf
The date format option works with the Beaver builder as well.June 7, 2022 at 1:14 AM #36342Greg
ParticipantThis is what I ended up with:
[rwmb_meta id="event_date" format="F j, Y"] -
AuthorPosts
- You must be logged in to reply to this topic.