title: Javascript pubDate RSS Format
body: <p>I have a RSS feed reader created using javascript and need to format the date.  At present the pubDate is set to .toLocaleDateString and displays differently on various machines.</p>
  
  <p>Does anybody know if I can set this to a standard dd/mm/yyyy format?</p>
  
  <p>Full javascript below:</p>
  
  <pre><code>    (function ($) {
          var current = null;
          $.fn.rssfeed = function (url, options) {
              var defaults = {
                  limit: 10,
                  header: true,
                  titletag: 'h4',
                  date: true,
                  content: true,
                  snippet: true,
                  showerror: true,
                  errormsg: '',
                  key: null
              };
              var options = $.extend(defaults, options);
              return this.each(function (i, e) {
                  var $e = $(e);
                  if (!$e.hasClass('rssFeed')) $e.addClass('rssFeed');
                  if (url == null) return false;
                  var api = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&amp;callback=?&amp;q=" + url;
                  if (options.limit != null) api += "&amp;num=" + options.limit;
                  if (options.key != null) api += "&amp;key=" + options.key;
                  $.getJSON(api, function (data) {
                      if (data.responseStatus == 200) {
                          _callback(e, data.responseData.feed, options);
                      } else {
                          if (options.showerror) if (options.errormsg != '') {
                              var msg = options.errormsg;
                          } else {
                              var msg = data.responseDetails;
                          };
                          $(e).html('&lt;div class="rssError"&gt;&lt;p&gt;' + msg + '&lt;/p&gt;&lt;/div&gt;');
                      };
                  });
              });
          };
          var _callback = function (e, feeds, options) {
              if (!feeds) {
                  return false;
              }
              var html = '';
              var row = 'odd';
              if (options.header) html += '';
              html += '&lt;div class="rssBody"&gt;' + '&lt;ul&gt;';
              for (var i = 0; i &lt; feeds.entries.length; i++) {
                  var entry = feeds.entries[i];
                  var entryDate = new Date(entry.publishedDate);
                  var pubDate = entryDate.toLocaleDateString() + ' ' + entryDate.toLocaleTimeString();
                  html += '&lt;li class="rssRow ' + row + '"&gt;' + '&lt;' + options.titletag + '&gt;&lt;a href="' + entry.link + '" title="View this feed at ' + feeds.title + '"  class="blog"&gt;' + entry.title + '&lt;/a&gt;&lt;/' + options.titletag + '&gt;'
                  if (options.date) html += '&lt;p class="date"&gt;' + pubDate + '&lt;/p&gt;'
                  if (options.content) {
                      if (options.snippet &amp;&amp; entry.contentSnippet != '') {
                          var content = entry.contentSnippet;
                      } else {
                          var content = entry.content;
                      }
                      html += '&lt;p&gt;' + content + '&lt;/p&gt;&lt;p&gt;&lt;a href="' + entry.link + '" class="blogbtn"&gt;continue reading&lt;/a&gt;&lt;/p&gt;'
                  }
                  html += '&lt;/li&gt;';
                  if (row == 'odd') {
                      row = 'even';
                  } else {
                      row = 'odd';
                  }
              }
              html += '&lt;/ul&gt;' + '&lt;/div&gt;'
              $(e).html(html);
          };
      })(jQuery);
  </code></pre>