如何以给定格式格式化日期

发布于 2024-09-24 12:00:27 字数 124 浏览 0 评论 0原文

大家好,我需要完全像这样设置日期格式 Dienstag 28. September 2010, 15:00 Uhr (德语单词),最好的方法是什么?谢谢。

我想我必须使用日期函数但如何编写格式

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 date function but how to compose format

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷爱 2024-10-01 12:00:27

date() 无法为您提供德语文本,您必须使用 strftime()

示例:

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

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);
陪你到最终 2024-10-01 12:00:27

setlocalestrftime

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

setlocale and strftime

setlocale(LC_TIME, 'de_DE@euro', 'de_DE', 'de', 'ge');
echo strftime("%A %d %B %Y, %H:%M");
孤独岁月 2024-10-01 12:00:27

您可以使用 setlocale() 设置 PHP 语言,然后使用 strftime( ) 具有相应的格式。这将使您获得德国的输出。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文