I have a unix timestamp in PHP
:
$timestamp = 1346300336;
Then I have an offset for timezones which I want to apply. Basically, I want to apply the offset and return a new unix timestamp. The offset follows this format, and unfortunately can't be changed due to compatibility with other code:
$offset_example_1 = "-07:00";
$offset_example_2 = "+00:00";
$offset_example_3 = "+07:00";
I tried:
$new_timestamp = strtotime($timestamp . " " . $offset_example_1);
But this does not work unfortunately :(. Any other ideas?
EDIT
After testing, I super surprised, but even this doesn't work:
strtotime("1346300336 -7 hours")
Returns false.
Let's approach this a bit different, what is the best way to transform the offset examples above, into seconds? Then I can simply just do $timestamp + $timezone_offset_seconds
.