<p>Given:</p>

<pre><code>DateTime.UtcNow
</code></pre>

<p>How do I get a string which represents the same value in an <a href="http://en.wikipedia.org/wiki/ISO_8601" rel="noreferrer">ISO 8601</a>-compliant format?</p>

<p>Note that ISO 8601 defines a number of similar formats. The specific format I am looking for is:</p>

<pre><code>yyyy-MM-ddTHH:mm:ssZ
</code></pre>

```
```
DateTime.UtcNow.ToString("s")
```
```
Returns something like 2008-04-10T06:30:00
```
UtcNow
```
obviously returns a
UTC
time so there is no harm in:
```
```
string.Concat(DateTime.UtcNow.ToString("s"), "Z")
```
```