title: add timezone for a given time in php
body: <p>i need to convert the given Australian times to UTC. this time can be from different states in AUS.  i have the states in the DB and stored the time offset in a column.</p>
  
  <p>i want to know how is possible to add a time offset or subtract it this way.</p>
  
  <p>// stored values of states and its column.</p>
  
  <pre><code>"NT" = +9.30
  "QLD" = +10.00
  "WA" = +8.00
  </code></pre>
  
  <p>i am taking selected date time this way and need to reduce the offset.</p>
  
  <pre><code>$timeAinUTC = date("H:i A", strtotime("07am")) - (offset); 
  
  i.e $timeAinUTC = date("H:i A", strtotime("07am")) - (+9.30);
  </code></pre>
  
  <p>how can i get this kind of a work done with php's datetime ?</p>
  
  <p><strong>EDIT 1,</strong></p>
  
  <p>I tried this to add my offeset but it seems like i cannot provide double values like 2.30 hours or 2.50</p>
  
  <p>It works when i ask it to add 2 hours this way.</p>
  
  <pre><code>strtotime($current_time . "+2hours");
  </code></pre>
  
  <p>but when i add like below , its wrong.</p>
  
  <pre><code>strtotime($current_time . "+2.30hours");
  </code></pre>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>All the sates available in AUS. 
  ACT, NSW, NT, QLD, SA, TAS, VIC, WA</p>
  
  <p><a href="http://wwp.greenwichmeantime.com/time-zone/australia/time-zones/" rel="noreferrer">http://wwp.greenwichmeantime.com/time-zone/australia/time-zones/</a></p>
  
  <p><strong>EDIT 3</strong></p>
  
  <p>I tried this as below as explained by a person in the answer.</p>
  
  <pre><code>$date = new DateTime('2013-10-01 01:45', new DateTimeZone('Australia/Melbourne'));
  echo $date-&gt;format('Y-m-d h:i:s A') . "&lt;br&gt;";
  
  $date-&gt;setTimezone(new DateTimeZone('UTC'));
  echo $date-&gt;format('Y-m-d h:i:s A') . "&lt;br&gt;";
  </code></pre>
  
  <p>But it outputs, </p>
  
  <pre><code>2013-10-01 01:45:00 AM
  2013-09-30 03:45:00 PM
  </code></pre>
  
  <p>How can this be wrong ? 2013-09-30 03:45:00 PM is wrong as per my understaing and actually it should be 10 hours behind from 2013-10-01 01:45:00 AM to be UTC, isnt it ?</p>