Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

how can I remove the time part from datepicker. When the page load , the time part is also showing

$
0
0

how can I remove the time part from datepicker. When the page load , the time part is also showing

Controller
 public async Task<IActionResult> Index()
        {
            IEnumerable<WeatherLocation> locList = _unitOfWork.Location.GetAll();

            WeatherVM weatherVM = new WeatherVM()
            {
                
                Locations = locList.Select(i => new SelectListItem
                {
                    Text = i.LocationName,
                    Value = i.LocationId.ToString()
                })
            };
            weatherVM.ForcastDate= DateTime.Now;

            //var Weather = new List<Weather>();
            //var weatherList = await _weatherRepository.GetWeatherAsync();

            return View(weatherVM);
        }

View
<div class="form-group row"><div class="col-sm-2"><label asp-for="ForcastDate"></label></div><div class="col-4"><input type='text' id="forcastDate" asp-for="ForcastDate"  class="form-control" /><span asp-validation-for="ForcastDate" class="text-danger"></span></div></div></form>
@section Scripts{<script>
        alert("alkds");$(document).ready(function () {$("#forcastDate").datepicker({ format: 'dd/mm/yyyy', date: new Date(1900, 01, 01), autoclose: true, todayBtn: 'linked' });

        });
    </script>
}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>