<p>I want to output a timestamp with a PST offset (e.g., 2008-11-13T13:23:30-08:00). <code>java.util.SimpleDateFormat</code> does not seem to output timezone offsets in the <em>hour:minute</em> format, it excludes the colon. Is there a simple way to get that timestamp in Java?</p>

<pre><code>// I want 2008-11-13T12:23:30-08:00
String timestamp = new SimpleDateFormat("yyyy-MM-dd'T'h:m:ssZ").format(new Date());
System.out.println(timestamp); 
// prints "2008-11-13T12:23:30-0800" See the difference?
</code></pre>

<p>Also, <code>SimpleDateFormat</code> cannot properly parse the example above. It throws a <code>ParseException</code>.</p>

<pre><code>// Throws a ParseException
new SimpleDateFormat("yyyy-MM-dd'T'h:m:ssZ").parse("2008-11-13T13:23:30-08:00")
</code></pre>

```
```
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'h:m:ss.SZ");
```
```
Is not what exactly you need?