title: how to display this string '20150211' as '2015-02-11' using jquery
body: <p>I am getting date as 20150211, but I want to display it like '2015-02-11' using jquery or any other way.</p>
  
  <p>I tried below code in .cshtml : </p>
  
  <pre><code>foreach (var item in ViewBag.Stats)
  {
      &lt;span class="visitDate"&gt;@item.ItemArray[0]&lt;/span&gt;
  }
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {            
          $(".visitDate").text().replace(/\s+/g, '-').toLowerCase();
      });
  &lt;/script&gt;
  </code></pre>