PHP :Set timezone based on timezone offset
<p>I am writing a program in php.</p>

<p>Normally we use <code>set_default_timzone()</code>  to set the time zone .</p>

<p>I have details of many users in my database and based on that i am trying to select the time zone for the user like </p>

<p>If user has chosen GMT + 5.30 at the time of registration ,I wanted to set default time zone as <code>('Asia/Kolkata')</code> for his profile page </p>

<p>So i am looking for a way so that i could set the time zone for user based on the time zone whatever  he had provided .</p>

<p>I am adding some more text Here </p>

<p>I have data like <code>GMT + 5.30</code> in my db based on this i wanted to set the time zone like </p>

<pre><code>if (timezone == "GMT + 5.30 "){
   set_default_timezone('Asia/Kolkata');
} 
</code></pre>

<p>Above code is logic only </p>

<p>Another one </p>

<pre><code>$offset = -5;
$timezone = getTimeZone($offset); //return America/New_York 
</code></pre>
