> -----Original Message----- > From: Lester Caine [mailto:[EMAIL PROTECTED] > Sent: 19 July 2006 09:53 > To: Derick Rethans > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] Re: PEAR::Date broken (Was: [PHP-CVS] > cvs: php-src(PHP_5_2) /ext/date php_date.c php_date.h) > > Derick Rethans wrote: > > > On Wed, 19 Jul 2006, Lester Caine wrote: > > > >>Andi Gutmans wrote: > >> > >>>I agree completely. Can't we just call the damn thing > DateTime stick it into > >>>RC1 of PHP 5.2, and move on? > >> > >>Gets my vote > >> > >>( Now we just need browsers to return REAL timezone data ;) ) > > > > http://talks.php.net/show/time-phptek6/30 works pretty well... (but > > talks.php.net doesn't have it so the example doesn't work there) > > Not sure, but I think that still has the same problem with > not knowing > the real timezone/daylight saving of the client? I need to > know how to > convert UTC to local time for an arbitrary date/time for displaying a > calendar. Current solution is that the client sets their > timezone/daylight saving in their profile, but it does not track when > they move locations or have multiple timezone/daylight login sites :(
If just need to display dates in localtime, I do it all on the client, by always sending a UTC datetime in a format that JS can parse. function localizeDate(span) { var local = span.cloneNode(true); var d = new Date(local.innerText); local.innerText = d.toLocaleString(); local.className = 'date local'; if (local.innerText != span.innerText) span.parentNode.replaceChild(local, span); } Unfortunately Mozilla/Firefox seems badly broken in that toLocaleString() returns the same string as was passed in. IE & Opera works fine. Jared -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php