I'm using AJAX to grab data from an XML file and print it back out to me. One of those is a date, and uses this code:
jQuery(function(){
$.ajax({
url: 'http://www.sagittarius-digital.com/news.rss',
dataType: 'xml'
}).done(function(xml){
var items = $(xml).find('item').map(function(){
var $item = $(this);
var array = '<div class="item">';
array += '<p>' + $item.find('pubDate').text() + '</p>';
return array;
So the line:
array += '<p>' + $item.find('pubDate').text() + '</p>';
brings back a date like this:
Mon, 18 Nov 2013 12:00:00 GMT
How can I cast this into YYYMMDD? Time is not required.
Live version in action (big buggy, take a while to load)