title: Javascript Date Returning NaN undefined NaN
body: <p>I am pulling modified dates from a SharePoint library and using the below to convert it:</p>
  
  <pre><code>    function convertSPDate(d) {
      // split apart the date and time
      var xDate = d.split("")[0];
      var xTime = d.split(" ")[1];
  
      // split apart the hour, minute, &amp; second
      var xTimeParts = xTime.split(":");
      var xHour = xTimeParts[0];
      var xMin = xTimeParts[1];
  
  
      // split apart the year, month, &amp; day
      var xDateParts = xDate.split("-");
      var xMonth = xDateParts[1]-1;    
      var xDay = xDateParts[2];
      var xYear = xDateParts[0];  
  
      var dDate = new Date(xYear, xMonth, xDay, xHour, xMin);
      return dDate;
  }
  </code></pre>
  
  <p>And then formatting it using:</p>
  
  <pre><code>function getformattedDate(d){
  var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "October", "Nov" , "Dec"];
  var getConvertedDate = d;
  return formattedDate =  getConvertedDate.getDate() +" "+month[getConvertedDate.getMonth()] +" "+getConvertedDate.getFullYear();     
  }
  </code></pre>
  
  <p>I'm then trying to display this date on a page for different items using:</p>
  
  <pre><code>var getDate = getformattedDate(convertSPDate(getFilteredItems[i].modified));
  </code></pre>
  
  <p>However this is just returning NaN undefined NaN - any help at all would be much appreciated!</p>