title: Localize dates on a browser?
body: <p>Let's say I have a date that I can represent in a culture-invariant format (ISO 8601).</p>
  
  <p>I'll pick July 6, 2009, 3:54 pm UTC time in Paris, a.k.a. 5:54 pm local time in Paris observing daylight savings.</p>
  
  <blockquote>
    <p>2009-07-06T15:54:12.000+02:00</p>
  </blockquote>
  
  <p>OK... is there any hidden gem of markup that will tell the browser to convert that string into a localized version of it?</p>
  
  <p>The closest solution is using Javascript's Date.prototype.toLocaleString().   It certainly does a good job, but it can be slow to iterate over a lot of dates, and it relies on Javascript.</p>
  
  <p>Is there any HTML, CSS, XSLT, or otherwise semantic markup that a browser will recognize and automatically render the correct localized string?</p>
  
  <p><strong>Edit</strong>:  </p>
  
  <p>The method I am currently using is replacing the text of an HTML element with a localized string:</p>
  
  <p>Starting with:</p>
  
  <pre><code>&lt;span class="date"&gt;2009/07/06 15:54:12 GMT&lt;/span&gt;
  </code></pre>
  
  <p>Using Javascript (with jQuery):</p>
  
  <pre><code>var dates = $("span.date", context);
  // use for loop instead of .each() for speed
  for(var i=0,len=dates.length; i &lt; len; i++) {
      // parse the date
      var d = new Date(dates.eq(i).text());
      // set the text to the localized string
      dates.eq(i).text(d.toLocaleString());
  }
  </code></pre>
  
  <p>From a practical point of view, it makes the text "flash" to the new value when the Javascript runs, and I don't like it.</p>
  
  <p>From a principles point of view, I don't get why we need to do this - the browser should be able to localize standard things like currency, dates, numbers, as long as we mark it up as such.</p>
  
  <hr>
  
  <p>A follow up question:  Why do browsers/the Web not have such a simple feature - take a standard data item, and format it according to the client's settings?</p>