title: Javascript count down time failing to display
body: <p>I want to display a countdown at the top of my page in my asp.net mvc site and I have been trying to create this using javascript, however the countdown is not displaying on my page and I don't understand why. Any help would be greatly appreciated thanks!</p>
  
  <p>This is my view and my script</p>
  
  <pre><code>@model Site.ViewModels.SummaryVm
  &lt;head&gt;
  &lt;title&gt;Order Summary&lt;/title&gt;
  
  &lt;/head&gt;  
      &lt;header&gt;
          &lt;h2&gt; Here is your order summary, please review before proceeding  with payment. Please complete this transaction within 15 minutes or your order will be cancelled.&lt;/h2&gt;
      &lt;/header&gt;
          &lt;div class="float-left"&gt;
               &lt;h2 id="countdown"&gt;&lt;/h2&gt;
          &lt;/div&gt;
    &lt;script type="text/javascript"&gt;
      var dt = '@ViewBag.CountDown_Time';
      var dateAr = dt.split('-');
      var newDate = dateAr[1] + '/' + dateAr[0] + '/' + dateAr[2];
  
      var end = new Date(dateAr[1] + '/' + dateAr[0] + '/' + dateAr[2]);
  
      var _second = 1000;
      var _minute = _second * 60;
      var _hour = _minute * 60;
      var _day = _hour * 24;
      var timer;
  
      function showRemaining() {
          var now = new Date();
          var distance = end - now;
  
          if (distance &lt; 0) {
              clearInterval(timer);
              document.getElementById('countdown').innerHTML = 'EXPIRED!';
  
              var eventID = 'eventID='+@Model.eventID;
              var orderID = 'orderID='+@Model.orderID;
              var quantity = 'quantity='+@Model.ticketQuantity;
  
              var days = Math.floor(distance / _day);
              var hours = Math.floor((distance % _day) / _hour);
              var minutes = Math.floor((distance % _hour) / _minute);
              var seconds = Math.floor((distance % _minute) / _second);
  
  
              document.getElementById('countdown').innerHTML = hours + 'hrs ';
              document.getElementById('countdown').innerHTML += minutes + 'mins ';
              document.getElementById('countdown').innerHTML += seconds + 'secs';
          }
  
          timer = setInterval(showRemaining, 1000);
      }
   &lt;/script&gt;
  </code></pre>
  
  <p>This is my Controller method</p>
  
  <pre><code>public ActionResult CreateOrder(OrderVm orderVm)
  {
   //code removed form brevity 
  
    if (Session["CountDown_Time"] == null)
    {
      Session["CountDown_Time"] = DateTime.Now.AddMinutes(15).ToString("dd-MM-yyyy h:mm:ss tt");
     }
      ViewBag.CountDown_Time = Session["CountDown_Time"];
  
       return View("OrderSummary", summaryVm);
     }
  </code></pre>