title: Date conversion in UTC
body: <p>I am working ruby on rails. In that I have a doubt in date conversion from current timezone to UTC.</p>
  
  <p>The date conversion function is</p>
  
  <pre><code>function date_conversion(date){
      out = moment(date, "DD/MM/YYYY").format('YYYY-MM-DD')
      var utc_time = moment.tz(out, zone).tz('UTC').format();
      return utc_time;
  }
  </code></pre>
  
  <p>Here params date let as "12/10/2019" which is in string format and let the zone is ""Asia/Kolkata". </p>
  
  <p>After executing the date_conversion function the values are</p>
  
  <pre><code>   out = moment(date, "DD/MM/YYYY").format('YYYY-MM-DD') 
  </code></pre>
  
  <p>The output of out = "2019-10-12"</p>
  
  <pre><code>   var utc_time = moment.tz(out, zone).format();
  </code></pre>
  
  <p>The value of utc_time is 2019-10-12T00:00:00+05:30. There is no problem while using above. But when  i am trying to convert to UTC as below</p>
  
  <pre><code>    var utc_time = moment.tz(out, zone).tz("UTC").format();
  </code></pre>
  
  <p>I got 2019-10-11T18:30:00Z.  In this situation I need of date in UTC but that date not to be changed. Please tell anybody some idea for this</p>
  
  <pre><code>$('#filter_id_linguist').on("click",function (event) {
   if($("#available_for_id").val()){
   var date = $("#available_for_id").val();
   $("#filter_forms_linguist_available_for").val(time_conversion(date));
   }
   else
   {
   $("#filter_forms_linguist_available_for").val("");
   }
  });
  </code></pre>
  
  <p>On above Javascript i am using function time_conversion. The id which are used in JS are comes from below rails form fields.</p>
  
  <pre><code>.form-group
  = f.label :with_bookings_from_date, "With bookings from", class: 'sr-only'
  .input-group.date{ style: "width:180px;", data: { behaviour: 'linguist-datepicker' } }
    // For time zone conversion
    = f.hidden_field :with_bookings_from_date
    = text_field_tag :with_bookings_from_date_display, '', value: @linguist_filter_form.with_bookings_from_date, placeholder: 'With bookings from', class: 'form-control', id: "with_bookings_from_date_id"
    %span.input-group-addon
      %span.glyphicon.glyphicon-calendar
  
  
  = f.submit 'Filter', class: 'btn btn-default', id: "filter_id_linguist"
  </code></pre>
  
  <p>I need help on how to convert date into UTC? </p>