Re: How to calculate my local time?
| From: | Richard Davey | Date: | Tue, 17 Feb 2004 12:17:57 +0000 |
| Subject: | Re: How to calculate my local time? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177931@lists.php.net to get a copy of this message | ||
Hello Hamid,
Tuesday, February 17, 2004, 11:47:32 AM, you wrote:
HH> My local time zone is GMT+3
HH> My website is located in a remote server with different time zone.
HH> So, How to calculate my time zone using the GMT functions in PHP?
There is an unknown part of your equation - the timezone of the
server.
Assuming your server is GMT-5 (i.e. hosted in the States) - that means
it is 8 hours behind you, so:
$my_time = strtotime("+8 hours");
Assuming your server is GMT+8 - that means it is 5 hours ahead of you:
$my_time = strtotime("-5 hours");
This will give you a timestamp based on now() on your server, adjusted
accordingly. Do with this what you will.
strtotime is your friend :)
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html