Format a date using the correct language in WordPress

To format a date and have it output the time in the language which is configured in WordPress, use the date_i18n function.

It uses the same parameters as date().

Example

Before

date('j F', time());

After

date_i18n('j F', time());

4 thoughts on “Format a date using the correct language in WordPress

  1. alp

    Thank you, I fixed my date language problem thanks to your article.

    Btw, I would like to ask another question about language. How could I fix these words =>”by, on, comments”?

    Do you have any language trick or must I fix manually?

    Thanks,
    Best regards,
    Alp

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.