Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Bobby 8 months, 3 weeks ago.

Assisted by: Bobby.

Author Posts
September 26, 2023 at 10:00 am #14465623

arnaudD-20

Hello team i need help with date translation i am sharing code to you i am getting date like this from our acf field
$event_start_date = get_field('event_start_date',$value);
$event_end_date = get_field('event_end_date',$value);
$startday = date('d',strtotime($event_start_date));
$endday = date('d F',strtotime($event_end_date));

i followed these links for achive this thing https://wpml.org/forums/topic/translate-date-in-blog/ , https://wpml.org/forums/topic/no-translation-of-language-on-date/ but not succeed i created a ticket too couple of days ago here "https://wpml.org/forums/topic/date-translation-having-issue-in-bootstrap-modal-popup/" but i was not able to check sorry for that can you please help me this time i am active i need to make site live and this issue need to be fix first please help me if need any more details thanks kindly reply as soon as possible waiting for your reply

Screenshot from 2023-09-26 15-21-22.png
September 27, 2023 at 8:43 pm #14477471

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for sharing the code, please review the following documentation on how to wrap strings in a gettext() call function in order for String Translation to register them

https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/

Let me know your results, please.

September 29, 2023 at 6:49 am #14485811

arnaudD-20

Hello thanks for your reply i checked the link you gave but it not solved my issue i can't register every date and do manually translation it is dynamic date so i want to get translated format like i am doing by this code
$startday = date('d',strtotime($event_start_date));
$endday = date('d F',strtotime($event_end_date));
it returns date in english only is there any way to get the correct date language if user is on french page it is fr date and on en it should be en date is there any better approach to fix this issue thanks

September 29, 2023 at 8:24 pm #14489989

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for updating me!

The way you are coding is your datte format following WordPresse's set date format?

Please review the following documentation on how to translate your date format

https://wpml.org/documentation/getting-started-guide/translating-your-sites-date-format-using-wpml/

OR I recommend to review how to localize your date in PHP via the following documentation by WP:
https://wordpress.org/documentation/article/customize-date-and-time-format/#localization

Let me know your results, please.

September 30, 2023 at 10:13 am #14491153

arnaudD-20

Thanks mate you saved my time have a nyc day it worked fine 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.