RE: [PHP] Time Zone Variables
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Fri, 01 Dec 2000 09:56:49 +0000 |
| Subject: | RE: [PHP] Time Zone Variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28181@lists.php.net to get a copy of this message | ||
You'll have to get the timezone from the user manually (I couldn't see
anything useful in the php variables from my browser...)
A quick look at the date function in php revealed some code that may be of
interest
Convert Times between Timezones
// First set the Timezone
// (see the zoneinfo directory-tree on your System for a list
// it is in /usr/share/zoneinfo on my System)
putenv("TZ=Europe/Rome");
// Calculate the Timstamp relative to the Timezone
$timestamp=mktime($hour,$minutes,$seconds,$month,$day,$year);
// Show the time
echo "Date ".date("d/m/Y H:i:s",$timestamp)." in ".getenv
("TZ")."\n";
// Now Change the Timezone
putenv("TZ=Australia/Adelaide");
// Show the time
echo "Date ".date("d/m/Y H:i:s",$timestamp)." in ".getenv
("TZ")."\n";
Cheers,
Lawrence.
-----Original Message-----
From: techzeus@pacific.net.sg [mailto:techzeus@pacific.net.sg]
Sent: December 1, 2000 05:24 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Time Zone Variables
How do you think I can go about doing that?
----- Original Message -----
From: "Richard Lynch" <richard@zend.com>
To: <php-general@lists.php.net>
Sent: Friday, December 01, 2000 9:43 AM
Subject: Re: [PHP] Time Zone Variables
> Not really.
>
> The browser does not, by default tell the web-server what their time-zone
or
> anything like that is.
>
> You can use Javascript on a preceding page to send the current time on
their
> computer's clock, and if you are willing to rely on (A) Javascript and (B)
> user's clocks, it can work for most users, but not all.
>
> Some sites ask you your time zone when you register, and store that -- Of
> course, if the person travels, that's rather useless.
>
> You might be best off just showing everything in GMT and let the user deal
> with it. Mucking with time zones is generally far more trouble than it
> looks like at first.
>
> ----- Original Message -----
> From: <techzeus@pacific.net.sg>
> Newsgroups: php.general
> Sent: Thursday, November 30, 2000 3:43 AM
> Subject: [PHP] Time Zone Variables
>
>
> Hi there,
>
> Is there a variable that can determine the user's timezone?
>
> I want to make a script to convert news postings to the person's time in
> that timezone.
>
>
> David Chua,
> CEO, Frozened.com
> PAGN.NET
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net