title: Display of today's date in the form (asp.net core)
body: <p>I want to display today's date in my film creation form.</p>
  
  <p>Controller:</p>
  
  <pre><code>    // GET: Movies/Create
      public IActionResult Create()
      {
  
          ViewData["IdGenre"] = new SelectList(_context.Genres, "IdGenre", "Name");
          return View();
      }
  
      // POST: Movies/Create
      // To protect from overposting attacks, enable the specific properties you want to bind to, for 
      // more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
      [HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Create([Bind("Id,Name,DateDeSortie,Stock,IdGenre")] Movie movie)
      {
  
  
          if (ModelState.IsValid)
          {
  
              _context.Add(movie);
              await _context.SaveChangesAsync();
              return RedirectToAction(nameof(Index));
          }
  
          ViewData["IdGenre"] = new SelectList(_context.Genres, "IdGenre", "Name", movie.IdGenre);
          return View(movie);
      }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code> [DataType(DataType.Date)]
      [Display(Name = "Date de sortie")]
      [Required(AllowEmptyStrings =false,ErrorMessage ="La date est requise")]
      public DateTime? DateDeSortie { get; set; }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code> &lt;div class="form-group"&gt;
              &lt;label asp-for="DateDeSortie" class="control-label"&gt;&lt;/label&gt;
              &lt;input asp-for="DateDeSortie" class="form-control" /&gt;
              &lt;span asp-validation-for="DateDeSortie" class="text-danger"&gt;&lt;/span&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>Thank you for your help I have been stuck for several days</p>