title: Converting between date/time formats in JavaScript
body: <p>I am working with a web service that returns date/times in OData v4 Format. That format looks like this: <code>yyyy-MM-ddTHH:mm:ss.fffZ</code>. This means the current time would be returned as: "2016-05-11T03:08:00Z".</p>
  
  <p>I have received this date in some client-side JavaScript. I am trying to format the date using the <a href="http://momentjs.com/" rel="nofollow">Moment.js</a> library. From my understanding, that library looks for an <a href="http://momentjs.com/docs/#/parsing/string/" rel="nofollow">ISO 8601 formatted string</a>.</p>
  
  <p>My question is, how do I convert the OData v4 string that I get into an ISO 8601 formatted string? Or, how do I just load the OData v4 string into a <code>moment</code> object? My biggest issue seems to be with time zones. For example: If I have</p>
  
  <pre><code>2016-06-01T00:00:00Z
  </code></pre>
  
  <p>then use</p>
  
  <pre><code>moment('2016-06-01T00:00:00Z').format('MM/DD/YYYY')
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>05/31/2016
  </code></pre>
  
  <p>However, I was expected <code>06-01-2016</code></p>
  
  <p>Thanks!</p>