Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42116 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11654 invoked from network); 5 Dec 2008 15:55:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Dec 2008 15:55:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=jochem@iamjochem.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jochem@iamjochem.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: jochem@iamjochem.com X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 Received: from [194.109.193.121] ([194.109.193.121:46848] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/39-20960-4EE49394 for ; Fri, 05 Dec 2008 10:55:17 -0500 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id D4D49287591; Fri, 5 Dec 2008 16:55:13 +0100 (CET) X-Virus-Scanned: amavisd-new at moulin.nl Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (mx1.moulin.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Iga5RiimeK8K; Fri, 5 Dec 2008 16:55:09 +0100 (CET) Received: from [192.168.1.61] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id 4AEC728775A; Fri, 5 Dec 2008 16:55:09 +0100 (CET) Message-ID: <49394EDD.90106@iamjochem.com> Date: Fri, 05 Dec 2008 16:55:09 +0100 User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: Derick Rethans CC: Lester Caine , PHP Developers Mailing List References: <4938C8FB.6010509@lsces.co.uk> In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Upgrading to internal DateTime From: jochem@iamjochem.com (Jochem Maas) 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: 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 format("U") ?> seems wrong, having something like 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