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);

Leave a Reply

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