Set default Date as todays Date in jQuery DatePicker in ASP.Net MVC

Last Reply 9 months ago By dharmendr

Posted 9 months ago

Code behind in View

<div class="form-group col-md-6">
   @Html.LabelFor(model => model.pickupdate_, htmlAttributes: new { @class = "control-label col-md-2" })
   <div class="col-md-10">
       @Html.Editor("txtpickupdate", DateTime.Now.ToShortDateString(), new { htmlAttributes = new { @class = "form-control input-datepicker", @placeholder = "mm/dd/yyyy" } })  
       @Html.ValidationMessageFor(model => model.pickupdate_, "", new { @class = "text-danger" })



Posted 9 months ago

Hi GuruLogu,

There are options to set the default Date. If you didn't change anything by default it will show the current date. If you still want then you can set like below.

$( ".selector" ).datepicker({ defaultDate: new Date() });


I agree, here is the link: