title: How to convert date time from ISO Format to UTC time zone?
body: <p>I am using <code>moment.js</code>, and I want to convert from ISO Format date time to UTC time zone.</p>
  
  <p>I can convert from local time to UTC+ISOformat, but I am not able to convert ISO format to UTC time zone.</p>
  
  <p>Input:</p>
  
  <pre><code>2018-03-22T00:00:00Z
  </code></pre>
  
  <p>Expected output:</p>
  
  <p>date should be in UTC time zone. If I calculate the it should be:</p>
  
  <pre><code>22018-03-21T18:30:00Z
  </code></pre>
  
  <ol>
  <li>First I want to convert into ISO, After that convert into UTC**. </li>
  </ol>
  
  <p><strong><em>Not able to Converted local date time to ISO then UTC</em></strong>   </p>
  
  <p>We can convert into string, But from ISO format can convert or not?<br/></p>
  
  <p><strong>Fox example:</strong>  I want to convert <code>ISODATE(2018-03-22T00:00:00Z)</code> into UTC time zone.</p>
  
  <pre><code>function toISO(dt) {
    return moment(dt).format("YYYY-MM-DDTHH:mm:ss") + "Z";
  }
  var date = new Date();
  var isoDate= toISO(date)
  </code></pre>
  
  <p><strong><em>Direct we can convert</em></strong></p>
  
  <pre><code>function toISOWithUtc(dt) {
        return moment(dt).utc().format("YYYY-MM-DDTHH:mm:ss") + "Z";
  }
  var date = new Date();
  toISO(date)
  </code></pre>