开发者

Function to show date with language specifics in PHP

开发者 https://www.devze.com 2023-02-19 19:35 出处:网络
Does anyone know how to 开发者_开发问答make a little function for date in PHP, and if possible, a way to change the function language.I\'d use the IntlDateFormatter class from the PHP\'s intl extensio

Does anyone know how to 开发者_开发问答make a little function for date in PHP, and if possible, a way to change the function language.


I'd use the IntlDateFormatter class from the PHP's intl extension. The nice thing about the intl extension is that it does not rely on system locales to be present/installed.

If installing system locales is no problem for you (or you can't get intl running) then have a look at strftime to format unix timestamps according to locale.

Edit: I just remembered I wrote a tutorial a few years ago about building the intl estension from source (on Debian): http://www.jejik.com/articles/2008/07/howto_build_and_install_the_intl_pecl_extension_for_php5_in_debian/

0

精彩评论

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