title: ASP.NET MVC EditorFor DateTime
body: <p>How to implement EditorFor DateTime?</p>
  
  <p>I already have editors for Date and Time separately. Can I use it for my DateTime editor?</p>
  
  <p>Are there any suggestions, how to do it?</p>
  
  <p><strong>Date editor:</strong></p>
  
  <pre><code>@model DateTime
  
  @Html.TextBox(string.Empty, (Model != default(DateTime) ? Model.ToShortDateString() : string.Empty), new { @class = "date form-control" })
  </code></pre>
  
  <p><strong>Time editor:</strong></p>
  
  <pre><code>@model DateTime?
  
  @Html.TextBox(string.Empty, (Model.HasValue ? Model.Value.ToString("HH:mm") : string.Empty), new { @class = "time form-control" })
  </code></pre>
  
  <p>I am using jQuery UI datepicker for date editor. Timepicker is also jQuery plugin.</p>