hi Derick, Derick Rethans schreef: > On Fri, 5 Dec 2008, Lester Caine wrote: >
... >> Second question. >> What is the current situation on translating dates? I've tried several ways >> of >> using setlocale, but at present I've not been able to get anything other than >> English out of the code. > > setlocale() is the only real solution right now. What most likely is > your problem is that you don't have the locales for the other languages > installed. > ... leaving aside timezone issues (they make my head hurt, kudos to you for having written that stuff!). according to my testing DateTime ignores the current locale completely ... there seems to be no way of cleanly extracting a locale formatted datetime string from a DateTime object ... there is not even a way to retrieve a unix timestamp from said object in order to pass it to strftime() or to an instance of IntlDateFormatter (which doesn't seem to accept a DateTime object as argument to the format() method. so the only way I can see of doing it is as follows: <?php setlocale(LC_TIME, "nl_NL"); $d = new DateTime(); echo strftime("%A, %d %B %Y", (int)$d->format("U")), "\n"; echo $d->format("D, F Y"), "\n"; ?> which gives me the following on my local machine: vrijdag, 05 december 2008 Fri, December 2008 having to use <?php (int)$d->format("U") ?> seems wrong, having something like <?php $d->getTimeStamp() ?> would seem better. Am I missing something? or is there actually a limitation in DateTime that should/will be addressed at some time in the future? personally I just looking to understand ... here's hoping you may be able to shed some light on the matter. rgds, Jochem -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php