Re: [RFC] HTTP timezone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/10/07, info@xxxxxxxxxxxxx <info@xxxxxxxxxxxxx> wrote:
Well, there is some use for a correct user timezone. I wrote php code that offers a different css file depending on the server time of day. So for example at noon it would use nice bright colors, and at midnight blacks and red, and ... you get the picture. Trouble was, this representation only worked for the timezone the server was in, and not for the timezone the visitor was in.

Here's the simple PHP timezone code in css_rotate.php:

$hour = date("G");
//echo $hour;
switch($hour) {
       case 0: // theme: sleep
       case 1:
       case 2:
       case 3:
       case 4:
               $current_css = "sleep.css";
               break;
       case 5: // theme 'dawn'
       case 6:
       case 7:
       case 8:
               $current_css = "dawn.css";
               break;
       case 9: // theme 'morning'
       case 10:
       case 11:
       case 12:
               $current_css = "morning.css";
               break;
       case 13: // theme 'afternoon'
       case 14:
       case 15:
       case 16:
               $current_css = "afternoon.css";
               break;
       case 17: // theme 'dusk'
       case 18:
       case 19:
       case 20:
               $current_css = "dusk.css";
               break;
       case 21: // theme 'night life'
       case 22:
       case 23:
               $current_css = "night.css";
               break;
       default:
               $current_css = "generic.css";
}
//$current_css = "sleep.css"; // for testing each css file


.. and the invocation in the external css call:
include( INSTALL_DIR . "css/css_rotate.php");
LINK rel="stylesheet" type="text/css" href="<?php echo INSTALLPATH;?>css/<?php echo $current_css;?>">

.. and that produced a timezone flavored website look and feel.

I wanted to add that I have found more than one server time to be incorrectly set too, so you cannot count 100% on the server either, but i would give it odds over a user passed timezone.

sincerely,
Rob
http://phpyellow.com


From: Stefanos Harhalakis <v13@xxxxxxxxxx>
To: ceo@xxxxxxxxx
Date: Sun, 10 Jun 2007 03:15:33 +0300
CC: php-general@xxxxxxxxxxxxx
Subject: Re:  [RFC] HTTP timezone
On Sunday 10 June 2007, Richard Lynch wrote:
> On Sat, June 9, 2007 8:06 am, Stefanos Harhalakis wrote:
> > Timezone: +0200
> >
> > that will specify their timezone offset. This way scripts will be able
> > to
> > provide appropriate date/time strings/representations and/or content.
>
> It's pretty useless and unreliable since user's clocks/timezone
> settings are incorrect far too often...

I'm only considering the timezone information. I believe that this is not the
proper way to think before making a start. The fact that many user's timezone
is incorrect doesn't mean that this is not needed. Lets just hope that one
day Windows will do the right thing and keep the time in UTC while displaying
it using the appropriate timezone.


Well, in this case you could use javascript to get the time of the
client, and then update the CSS code according to the time.

To get back to the point, I think that the timezone should be defined
on what time it actually is at his PC, and what time it is on
time.nist.gov for example, and not lookng at some setting... Timezone
setting is often wrong, people just update their time to match the
time of their watch. This sets the UTC time wrong too, but still
displays the right time to the user. So if you compare this time to
time on web servers that are allways right, and you compare the
difference between that, then you know the timezone that is probably
right.

Tijnema

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux