Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42112 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10092 invoked from network); 5 Dec 2008 09:22:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Dec 2008 09:22:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.94.239.7 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.94.239.7 mail.jdi-ict.nl Linux 2.6 Received: from [82.94.239.7] ([82.94.239.7:55459] helo=mail.jdi-ict.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/F4-20960-CC2F8394 for ; Fri, 05 Dec 2008 04:22:21 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.jdi-ict.nl (8.13.7/8.12.11) with ESMTP id mB59MGgH021951; Fri, 5 Dec 2008 10:22:17 +0100 Date: Fri, 5 Dec 2008 10:22:16 +0100 (CET) X-X-Sender: derick@kossu.ez.no To: Lester Caine cc: PHP Developers Mailing List In-Reply-To: <4938C8FB.6010509@lsces.co.uk> Message-ID: References: <4938C8FB.6010509@lsces.co.uk> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Upgrading to internal DateTime From: derick@php.net (Derick Rethans) On Fri, 5 Dec 2008, Lester Caine wrote: > First question. > Why are there two different formats for dates with date creation using one > format and everything else using strftime formatting? Don't understand what you mean by this. > ( Slipping a date through DateTime and returning it DATE_W3C seems to be > adding the correct daylight saving details so far and allowing ADOdb date to > work ) This is not the correct thing to do, as you will lose timezone information. The W3C format only stores UTC offsets (in the form of +00:00). However, that same UTC offset can be used in different areas with different DST changes. Best thing is to store in Unix timestamps. > 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. > Third question > In order to get things working I've ended up with date_default_timezone_set() > and haven't needed to use DateTimeZone at all ( other than to get a list for > the user to select from ). Internally we are working UTC normalized, and then > displaying with the user offset if they select 'local'. IS the correct thing > to be setting the default for each user? I suspect yes since previous code has > always had to fight the server time setting changing things. Yes, I would do so as well. Especially because all date/time functions use this timezone. DateTime objects however can have information embedded to override this default timezone though. DateTimeZone is only really useful to get information from timezones, to do DST calculations etc. regards, Derick -- HEAD before 5_3!: http://tinyurl.com/6d2esb http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org