i've switched to Italian Language for my wordpress website and it shows the translation correctly, but when i try retrieve date and time with this code echo "<span class='date' style='margin-left:-20px;'>"; echo date('l, jS F, Y'); echo "</span>"; it gives me an output in English. Why is happening this ?

  • try this function: codex.wordpress.org/Function_Reference/date_i18n
    – mmm
    Commented Oct 13, 2017 at 9:28
  • @mmm as an answer (with a little bit more context) please :)
    – Rarst
    Commented Oct 13, 2017 at 9:48
  • @Rarst no I'm feed up by users who downvote my answers without explainations then I will no more write answers if a comment is enough to help.
    – mmm
    Commented Oct 13, 2017 at 12:48
  • @mmm the problem is such questions haunt site as "unanswered" and it is much harder to spot helpful information in a tiny comment, than a proper answer. You are always welcome to inquire on meta for advice on how to improve your answers, if you want to.
    – Rarst
    Commented Oct 13, 2017 at 13:06

1 Answer 1


The date() is a native PHP function. Its output depends on PHP locale and timezone settings. In a typical WP environment that would be default English locale and UTC time zone (which WP sets during core boot).

Since WP implementation of Date/Time component predates PHP 5 and its enhancements, it has a lot of own functions and conventions.

The appropriate WP function to use for localized output of date is date_i18n(). It depends on WP locale and time zone settings, ignoring PHP ones.

It should be noted that there are many outstanding edge cases and breakage with date_i18n() implementation. Any use of it must be carefully audited for correctness, especially for output of timezone information.

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.