News Feed
Sections




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

Lorna Mitchell's Blog:
Locale-Sensitive Dates in PHP
November 05, 2008 @ 08:48:44

Lorna Mitchell shares a quick code snippet she's worked up to make handling local-sensitive dates in PHP a bit easier (via the strftime function).

I needed dates like "Donderdag 23 Oktober", and I was sure PHP should know how to do this without me creating arrays for days of the week and months of the year. With some help from my friend (thanks Derick) I discovered that there is a date function in PHP that takes into account the locale of the script, called strftime.

Her code snippet shows how to set the correct local time (in her case, nl_NL with a UTF-8 encoding) and how to return a formatted string based on formatting characters (much like printf/sprintf).

0 comments voice your opinion now!
local sensitive date setlocalte strftime tutorial


blog comments powered by Disqus

Similar Posts

Karsten Dambekalns' Blog: PHP, Xdebug and PhpStorm - working!

Twilio Blog: How to Build an MMS Ticketing System Using PHP, Laravel and Twilio

Nikita Popov: How to add new (syntactic) features to PHP

PHPMaster.com: Localizing PHP Applications "The Right Way", Part 5

DevShed: Decoupling the Validation of Data with Bridge Classes in PHP 5


Community Events

Don't see your event here?
Let us know!


install release introduction framework laravel5 voicesoftheelephpant podcast series opinion language unittest example xdebug php7 interview extension laravel api library community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework