Translate date("d F Y (H:i) function php

后端 未结 3 1646
臣服心动
臣服心动 2021-02-04 09:07

I\'m brazilian and there\'s a wordpress plugin that uses

\" . date(\"d F Y (H:i)\",$date) . \"

Output: 16 January 2013 (00:54)

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 09:53

    The documentation for date already answers this:

    To format dates in other languages, you should use the setlocale() and strftime() functions instead of date().

    And strftime says that the way to do what is by using setlocale:

    Format the time and/or date according to locale settings. Month and weekday names and other language-dependent strings respect the current locale set with setlocale().

    That said, the C locale-aware functions do not provide sufficient functionality for languages that have cases. In such situations (i.e. most of the time) you need to roll your own.

提交回复
热议问题