title: c# DateTime only need date
body: <pre><code>//my model/////////////////////////
      [Required(ErrorMessage=&quot;Need a date of birth&quot;)]
      [DataType(DataType.Date)]
      public System.DateTime ParticipantDOB { get; set; }
  
  
  /////my controller//////////////////////////////////////////////////////////
  [HttpGet]
  [Route(&quot;participantDetails/{ParticipantId}&quot;)]
  public IActionResult ParticipantDetails(int participantId)
  {
          if(HttpContext.Session.GetInt32(&quot;UserId&quot;) == null)
          {
              return RedirectToAction(&quot;Index&quot;,&quot;Home&quot;);
          }
          Participant TheParticipant = db.Participants.FirstOrDefault(i=&gt;i.ParticipantId == participantId);
          ViewBag.ChildDetailsFirstName = TheParticipant.ParticipantFirstName;
          ViewBag.ChildDetailsLastName = TheParticipant.ParticipantLastName;
          ViewBag.ChildDetailsGender = TheParticipant.ParticipantGender;
          ViewBag.ChildDetailsDOB = TheParticipant.ParticipantDOB.Date;
          return View(&quot;ParticipantDetailsPage&quot;, TheParticipant);
      }
  
  
  // my cshtml////////////////////////////////////
  &lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
  &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
  &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  @model Participant
  &lt;p&gt;participant details page&lt;/p&gt;
  &lt;h1&gt;@ViewBag.ChildDetailsFirstName @ViewBag.ChildDetailsLastName&lt;/h1&gt;
  &lt;p&gt;Gender: @ViewBag.ChildDetailsGender&lt;/p&gt;
  &lt;p&gt;Date of birth: @ViewBag.ChildDetailsDOB&lt;/p&gt;
  //test////
  &lt;p&gt;@Model.ParticipantDOB.Date&lt;/p&gt;
  </code></pre>
  
  
  <p>/////////////////////////////////////////////////////////////////////////////////////</p>
  <p>i tried looking at microsofts doc and they told me to just add .Date and it still doesn't work. The time stamp is still following my date even though my form never asked for a date</p>
  <p>Docs i was looking at:
  <a href="https://docs.microsoft.com/en-us/dotnet/api/system.datetime.date?view=net-5.0" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/api/system.datetime.date?view=net-5.0</a></p>