PHP has a timezone environment variable that you can modify with the putenv() function. Then any calls to the date function will give time in that timezone.
You just need to replace the "America/Los_Angeles" string with whatever timezone you want from the following list (timezone strings are the 3rd item in each row): http://www.theprojects.org/dev/zone.txt
You didn't include places like Arizona where DST is not observed. If you do a complex solution like that, you will need to research which locations observe DST. Also, you never quite gave it in a timestamp.
Heh. Being that everybody is posting just about every solution under the sun. Assuming the timestamp is based on Greenwich Mean Time, you could use something like:
function get_timezone ($timestamp, $offset){
return $timestamp+(3600*(int)$offset);
}
It is simple, robust, and much more efficient then strtotime(). An example of usage would be:
All that is needed for timezone conversion is strtotime. merwetta1's post is useful in the sense that it gives the time offsets for other zone so i propose split:
Diablo84 & merwetta1
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
<?php
$time = strtotime("+ 1 hour"); //the timestamp
echo date("H:i:s",$time);
?>
if you wanted it to be dynamic (eg. selecting the time difference via a drop down) you could do
<?php
$offset = $_POST['drop_down_name'];
$time = strtotime("+ $offset hours");
echo date("H:i:s",$time);
?>
note the offset would be the offset from your servers time zone