开发者

How to format a date in a given format

开发者 https://www.devze.com 2023-01-17 01:11 出处:网络
Hi all I need to format date exactly like this Dienstag 28. September 2010, 15:00 Uhr (German words), what is the best way? Thanks.

Hi all I need to format date exactly like this Dienstag 28. September 2010, 15:00 Uhr (German words), what is the best way? Thanks.

I guess I have to use d开发者_JAVA百科ate function but how to compose format


date() won´t be able to get you a German text, you will have to use strftime()

Example:

setlocale(LC_TIME, "de_DE");
strftime("%A %e. %B %Y, %H:%M Uhr", $your_date);


setlocale and strftime

setlocale(LC_TIME, 'de_DE@euro', 'de_DE', 'de', 'ge');
echo strftime("%A %d %B %Y, %H:%M");


You can set your language in PHP with setlocale() and then use strftime() with the corresponding format. That will allow you to get german output.

0

精彩评论

暂无评论...
验证码 换一张
取 消