I was wondering how to do the best user configuration when the user sets his own GMT time, e.g. if a user was in the GMT+3 timezone and the user sets it via the UCP.
What I've done was, every option in the drop-down menu:
<select name="timezone">
...
<option value="-7200">GMT-2</option>
<option value="-3600">GMT-1</option>
<option value="0">GMT</option>
<option value="3600">GMT+1</option>
<option value="7200">GMT+2</option>
...
</select>
Like that, and when the user chooses it, it will add the value into his user field in the database.
What I'm stuck on is when a post has been created by a user, it uses the time() stamp, and I use the gmdate() function which is this:
while(loop goes here)
{
$post_time = $row['post_time'] // e.g. 1282165261
if($row['user_timezone'] > 0)
{
$timezone = $post_time-$row['user_timezone'];
}
else
{
$timezone = $post_time+$row['user_timezone'];
}
}
Which is outputted with this timestamp format:
gmdate("D jS M Y @ g:iA", $timezone);
But the problem is, if I use something below than GMT, e.g. GMT-1, GMT-6, it changes to +
The question is, what would be the best way to configure timestamps to the user preferred GMT time?