I basically need to change the date format to german date format all over the WordPress site and I succeed it by changing the date time settings from the WordPress admin panel.

Settings » General :

Date Format - Custom : j. F Y

eg : 5. July 2016

However I need to change the month names to german as well.

eg : 5. Juli 2016

How should I do that ?


4 Answers 4


WordPress has a special function for translating dates, called date_i18n. General usage:

echo date_i18n( $dateformatstring, $unixtimestamp, $gmt);

Supposing you have German as your site's language this would be:

echo date_i18n( 'j. F Y', false, false);

You can also import the time format from the admin settings, like this:

echo date_i18n(get_option('date_format'), false, false);
  • unfortunately I'm not using the german as site's language. Jul 5, 2016 at 12:58
  • In that case, you can't use WP's built in translation module. Your own function would be a fine solution then.
    – cjbj
    Jul 5, 2016 at 13:04

I have added the following code to child theme function and it works,

add_filter('the_time', 'modify_date_format');
function modify_date_format(){
    $month_names = array(1=>'Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');
    return get_the_time('j').'. '.$month_names[get_the_time('n')].' '.get_the_time('Y');

But I'm not sure this is the correct way to do it.

  • Great solution if you are not using German as the Wordpress language, many thanks!
    – nsilva
    Jan 10, 2017 at 14:26
  • this solution is not working for me ? I have added above code in function.php
    – Narayan
    Jan 11, 2018 at 6:49

go to admin follow 2 simple steps

  1. Date Format - Custom : j. F Y

  2. Change Site Language which one you want change and then save

enter image description here

  • 1
    I have tried this solution before, due to some reason the site language is not changing to German. Jul 5, 2016 at 17:27
  • 1
    @JanithChinthana, you need to ensure the language locale is installed on your server. See askubuntu.com/a/76106/682407 for more info. Mar 7, 2019 at 9:45

Use locale in wp-config.php de_DE, language settings depends on admin panel language, it is possible to separate site language and admin panel language. Also in wp-content>languages look for de_DE.po, use search.

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.