Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42120 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95173 invoked from network); 6 Dec 2008 05:14:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2008 05:14:21 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 213.123.26.183 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 213.123.26.183 c2beaomr05.btconnect.com Received: from [213.123.26.183] ([213.123.26.183:1364] helo=c2beaomr05.btconnect.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/96-01047-92A0A394 for ; Sat, 06 Dec 2008 00:14:18 -0500 Received: from [10.0.0.150] (host81-138-11-136.in-addr.btopenworld.com [81.138.11.136]) by c2beaomr05.btconnect.com (MOS 3.8.6-GA) with ESMTP id BIS00680; Sat, 6 Dec 2008 05:14:09 GMT Message-ID: <493A08F3.6090500@lsces.co.uk> Date: Sat, 06 Dec 2008 05:09:07 +0000 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.8.1.18) Gecko/20081112 SeaMonkey/1.1.13 MIME-Version: 1.0 To: PHP Developers Mailing List References: <4938C8FB.6010509@lsces.co.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/50, host=c2beaomr05.btconnect.com X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A010201.493A0A26.00B3,ss=1,fgs=0, ip=10.0.0.150, so=2007-10-30 19:00:17, dmn=5.7.1/2008-09-02 X-Junkmail-IWF: false Subject: Re: [PHP-DEV] Upgrading to internal DateTime From: lester@lsces.co.uk (Lester Caine) Derick Rethans wrote: >> ( 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. OK - I think I understand what is 'missing' now! The only thing ever stored in the database *IS* Unix timestamps. Doing anything other than that is unmanageable, yet some frameworks use 'server based' times in their systems, simply because they do not bother with daylight saving and only 'serve' one timezone! The second you have to manage 'real' time across timezones then daylight saving becomes essential, BUT only on the display side! Since the browser only provides a time offset, this is useless and to be honest should simply be ignored ( until it is upgraded to provide the correct information ;) ). So we need a 'display' function that takes a simple numeric epoch, and a separate timezone id into which the epoch is to be 'converted'. My W3C mapping works simply because ADOdb then converts that to it's own simple offset abbreviation - in my case GMT or BST. As long as DateTime passes the full 64 bit number the date range from 100AD is also preserved ( and further back if 2 digit years are disabled ). If I want to display the 'real' timezone with this 'time' then I just add it in place of ADOdb's 'timezone'. I am tempted to simply adjust the ADOdb class to take a timezone in place of the simple GMT switch it currently uses. The return path is just the reverse and simply needs to take the client display offset off prior to storage of the UTC epoch. SO we use DateTimeZone to get an offset value for the clients timezone and simply add or subtract this from a timezone agnostic display on the client end when entering new times. ( I've posted this simply as an aid - it may help someone ) -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php