title: Generate an RFC 3339 timestamp similar to Google Tasks API?
body: <p>I am in the process of building an app that syncs with Google Tasks. As part part of the syncing, I want to compare the local task and the API task, and see which one has been changed more recently.</p>
  
  <p>Each task from Google's API contains an <code>updated</code> property, which looks like this:</p>
  
  <pre><code>2011-08-30T13:22:53.108Z
  </code></pre>
  
  <p>Now I would like to generate a timestamp similar to that, so that every time I update a task on my app it sets a new <code>updated</code> value. To generate the RFC 3339 timestamp I am using - <a href="http://cbas.pandion.im/2009/10/generating-rfc-3339-timestamps-in.html" rel="noreferrer">http://cbas.pandion.im/2009/10/generating-rfc-3339-timestamps-in.html</a> which generates something like this:</p>
  
  <pre><code>2011-08-30T09:30:16.768-04:00
  </code></pre>
  
  <p>The issue is, the API date is always coming back as "greater" than the local date, even when the local date is newer. I'm guessing it has something to do with the different formatting between the two.</p>
  
  <p>Here are two dates, the top is from the Google Tasks API (from about 10 minutes ago), and the bottom one was generated locally a minute ago. When compared which is greater, it's telling me the top one is.</p>
  
  <pre><code>2011-08-30T13:22:53.108Z
  2011-08-30T09:41:00.735-04:00
  </code></pre>
  
  <p>Is my formatting wrong? What I am doing wrong here? Any help on this is really appreciated.</p>