title: bootstrap-datetimepicker convert selected local date to UTC
body: <p>im using bootstrap-datetimepicker from <a href="http://tarruda.github.io/bootstrap-datetimepicker/" rel="nofollow">http://tarruda.github.io/bootstrap-datetimepicker/</a>
  this gives the option to select the datetime in local time, what i cannot understand is how do i convert it to UTC before sending it to the cgi. I need to do this because my server is set at GMT timezone and the input can come in from any timezone.<br>
  so i would like the user to select the time in his tz but convert that selection to gmt which sending it to my cgi script.<br>
  if there is any other better way of solving this issue also i would appreciate it.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('#timetime').datetimepicker({
          maskInput: true,
          format: 'yyyy-MM-dd hh:mm',
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>it is being called in the form in the below code</p>
  
  <pre><code>&lt;label for="sdate" class="control-label"&gt;* Scheduled Date (UTC/GMT)&lt;/label&gt;
  &lt;div id="timetime" class="controls"&gt;
      &lt;input id="sdate" name="sdate" type="text" placeholder="YYYY-MM-DD HH:MM"&gt;&lt;/input&gt;
      &lt;span class="add-on"&gt;
          &lt;i data-time-icon="icon-time" data-date-icon="icon-calendar"&gt;&lt;/i&gt;
      &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>final answer based on the help given by filmor</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
              $('#timetime').datetimepicker({
                              maskInput: true,
                            format: 'yyyy-MM-dd hh:mm',
                            });
  
  $("form").submit(function(){
     // Let's find the input to check
     var $input = $(this).find("input[name=sdate]");
     if ($input.val()) {
    // Value is falsey (i.e. null), lets set a new one, i have inversed this, input  should be truthy
    //$input.val() = $input.val().toISOString();
      var d = $input.val();
      var iso = new Date(d).toISOString();
    //  alert(iso);
      $input.val(iso);
     }
   });
            &lt;/script&gt;
  </code></pre>
  
  <p>further update to work on both firefox and chrome</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $("form").submit(function(){
      // Let's find the input to check
      var input = $(this).find("input[name=sdate]");
      if (input.val()) {
              var picker = $('#timetime').data('datetimepicker');
      //      alert(input.val());
      //      alert(picker.getLocalDate().toISOString());
              input.val(picker.getLocalDate().toISOString());
              }
      });
  &lt;/script&gt;
  </code></pre>