Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

supptech's avatar

Date month get german locale

Hey, i want to print the month name.

How i can print the german month name?

I tried to set the locale like:

@php setlocale(LC_TIME, 'de_DE', 'deu_deu'); @endphp

For weekdays its works, but not for months.

Is there a solution for? Thanks

0 likes
3 replies
tisuchi's avatar

@supptech Try this:

setlocale(LC_TIME, 'de_DE.UTF-8'); // Set locale to German
echo strftime("%B", time()); // Prints the current month in German
1 like
supptech's avatar

This works, but is it possible to print the last month?

Before i did with:

'''date("F",strtotime("-1 month"))'''

tisuchi's avatar

@supptech I think you can try this:

setlocale(LC_TIME, 'de_DE.UTF-8');
echo strftime("%B", strtotime("-1 month"));
2 likes

Please or to participate in this conversation.