title: Convert Ruby Time to HTML5 global date & time String
body: <p>In Ruby, how do I convert the<code>Fixnum</code> 1291132740128 (milliseconds since the epoch) to the equivalent <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-global-date-and-time-string" rel="nofollow">HTML5 global time &amp; date string</a> (Also see <a href="http://diveintohtml5.info/semantics.html#time-element" rel="nofollow">HTML5 time element explanation</a>. E.g., 1979-10-14T12:00:00.001-04:00)?</p>
  
  <p>My first attempt is:</p>
  
  <pre><code>&gt; Time.at(1291132740128/1000.0).strftime("%Y-%m-%dT%H:%M:%S-%Z")
  =&gt; "2010-11-30T10:59:00-EST"
  </code></pre>
  
  <p>But, (1) how do I get the milliseconds? Does Time store the milliseconds?<br />
  And, (2) how do I get the timezone to be -0400 or -0500, depending on whether it's daylight savings time?</p>
  
  <p>EDIT: Now that I think about it, perhaps it's better to keep it as 1291132740128 and do the conversion with JavaScript according to the browser location. What do you think?</p>