0

I have current_time in theme and it displays date like: THURSDAY, NOVEMBER 10, 2016. But I need to translate it to Persian. How can I do this?

2 Answers 2

2

Used date_i18n instead of current_time. For example:

echo date_i18n( 'Y. F j.',  strtotime( get_the_time( "Y-m-d" ) ) );
1
  • You've overcomplicated. :) get_the_time('Y. F j.') would be sufficient, it will take care of localization internally.
    – Rarst
    Commented Nov 10, 2016 at 16:57
1

It may be worth looking at using something like date_i18n, which returns the date/time in a localised format

https://codex.wordpress.org/Function_Reference/date_i18n

To recreate the current_time format you showed in your example, you could use something like date_i18n('l, F j, Y');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.