title: How to get correct date format in ajax?
body: <p>I have an function to get forecast weather ajax to load this into div but the date in <code>json</code> have a datetime <code>format type: "dt":1452254400</code></p>
  
  <p>I need format: <code>'Y-m-d'</code> but in ajax I can't use the <code>gmdate()</code> php function to get this. </p>
  
  <p>I'm trying get this with </p>
  
  <pre><code>  $.ajax({
      url: urlforecast,
      dataType:"JSON",
      success:function(data){
         var str = (""+data['list'][0]['dt']);
  
         var num = parseInt(str.replace(/[^0-9]/g, ""));
         var date = new Date(num);
         alert(date);
  </code></pre>
  
  <p>But he format is: <code>Sat Jan 17 1970 20:29:56 GMT+0100</code> and I dislike this.</p>
  
  <p>How can I get the format like <code>gmdate()</code> into <code>ajax</code> function? </p>