title: cant pass current Date & Time using Viewdata in mvc
body: <p>i am new in MVC.I try to pass Current Date &amp; Time by using Viewdata.But it does not get my code is here</p>
  
  <pre><code>namespace FirstHelloWorldProjct.Controllers
  {
      public class HelloWorldController : Controller
      {
          //
          // GET: /HelloWorld/
          public ActionResult Index()
          {
              ViewData["CurrentTime"] = DateTime.Now.ToString();
              return View();
          }
      }
  }
  </code></pre>
  
  <p>And my View Code here</p>
  
  <pre><code>@{
      Layout = null;
  }
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width" /&gt;
      &lt;title&gt;Index&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
          This is Hello World...&lt;br/&gt;
          The Current Date and time is &lt;%= ViewData["CurrentTime"]%&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And output is here
  <code>This is Hello World...
  The Current Date and time is &lt;%= ViewData["CurrentTime"]%&gt;</code></p>