Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Simon Holywell:
International PHP dates with intl
Jul 22, 2015 @ 17:55:33

Following up on his previous post about date/time handling and localization, Simon Holywell has posted an update with information about using the "Intl" extension for PHP to get it working with the more powerful PHP DateTime handling.

I wrote about localising dates (and other data) in a recent blog post, but unfortunately there were some shortcomings where time zones were concerned. As I alluded to in that post there is a way around this via the Intl extension that exposes a simple API to format DateTime instances. Thankfully this follow up post will be quite short as the setup is very simple for those of you on Ubuntu/Debian you can use the repositories.

He includes the commands you'll need to install the extension (via apt-get), compile it via the "pecl" command and update your php.ini file to enable it. He also includes some code examples showing how to use the IntlDateFormatter handling to work with dates, formats and calendars.

tagged: international datetime intl extension tutorial aptget pecl

Link: https://www.simonholywell.com/post/2015/07/international-php-dates-with-intl/


Trending Topics: