title: Convert local date time to UTC date time
body: <p>When user enters Date and time using 'input type=date name="date"' &amp;&amp; 'input type=time name="time"' tags according to his/her timezone,</p>
  
  <p>for eg :- If a user from India, (Asia/Kolkata) timezone entered a date : 1/22/14 and time :  5:30pm , I need to Convert it into  UTC time stamp for storing it to DB, To Achive that </p>
  
  <p>I used below code:-</p>
  
  <pre><code>$year=substr($date,0,4);
  $month=substr($date,5,2);
  $day=substr($date,8);
  $hour=substr($time,0,2);
  $minute=substr($time,3);
  $clientzone=mysql_result(mysql_query("select timezone from c_users_extra where  c_id='{$_SESSION['clientid']}'"),0,0); //Fetches the timezone of user
  date_default_timezone_set($clientzone);//Setting default timezone to client timezone
  $datetime = new DateTime("$year-$month-$day $hour:$minute:00");
  $la_time = new DateTimeZone('UTC');
  $datetime-&gt;setTimezone($la_time);
  $values=$datetime-&gt;format('Y-m-d H:i:s');
  $year=substr($values,0,4);
  $month=substr($values,5,2);
  $hour=substr($values,11,2);
  $minutes=substr($values,14,2);
  $seconds=substr($values,17,2);
  $timestamp=mktime($hour,$minutes,$seconds,$month,$day,$year);//creating new timestamp from coverted 
  print_r(getdate($timestamp));//Result :  Array ( [seconds] =&gt; 0 [minutes] =&gt; 30 [hours] =&gt; 6 [mday] =&gt; 22 [wday] =&gt; 3 [mon] =&gt; 1 [year] =&gt; 2014 [yday] =&gt; 21 [weekday] =&gt; Wednesday [month] =&gt; January [0] =&gt; 1390372200 )
  //Expected Result : Array ( [seconds] =&gt; 0 [minutes] =&gt; 0 [hours] =&gt; 12 [mday] =&gt; 22 [wday] =&gt; 3 [mon] =&gt; 1 [year] =&gt; 2014 [yday] =&gt; 21 [weekday] =&gt; Wednesday [month] =&gt; January [0] =&gt; 1390372200 ) 
  </code></pre>
  
  <p>Why I get this wrong time stamp ? </p>