title: Rails - Convert time to string
body: <p>This is the time format I want to convert</p>
  <pre><code>time = Time.parse('2020-07-02 03:59:59.999 UTC')
  #=&gt; 2020-07-02 03:59:59 UTC
  </code></pre>
  <p>I want to convert to string in this format.</p>
  <pre><code>&quot;2020-07-02T03:59:59.999Z&quot;
  </code></pre>
  <p>I have tried.</p>
  <pre><code>time.strftime(&quot;%Y-%m-%dT%H:%M:%S.999Z&quot;)
  </code></pre>
  <p>Is this correct? Any better way?</p>