Formatting SQL Server date causes datatype issue
<p>When I tried this SQL query</p>

<pre><code>select format(getdate(), 'yyyy-MM-dd HH:mm:ss.fff')
</code></pre>

<p>I get this result:</p>

<pre><code>2016-07-01 23:19:16.573
</code></pre>

<p>But when I try this, it throws an error:</p>

<pre><code>select format('2016-06-28T23:44:23.7573244Z', 'yyyy-MM-dd HH:mm')
</code></pre>

<p>Error:</p>

<blockquote>
  <p>Argument data type varchar is invalid for argument 1 of format function.</p>
</blockquote>

<p>Why is this happening? I think both are almost similar.</p>