Search results

Getting Started

This section briefly explains about how to include a simple DateTimePicker in your ASP.NET MVC application. You can refer ASP.NET MVC Getting Started documentation page for introduction part of the system requirements and configure the common specifications.

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to include a license key in your projects. Please refer to this link to know about registering Syncfusion license key in your ASP.NET MVC application to use our components.

Initialize DateTimePicker component to the Application

DateTimePicker component can be rendered by using the EJS().DateTimePicker() tag helper in ASP.NET MVC application. Add the below simple code to your index.cshtml page which is available within the Views/Home folder, to initialize the DateTimePicker.

The following example shows a basic DateTimePicker component.


Running the above code will display the basic DateTimePicker on the browser.

Setting the min and max

The minimum and maximum date time can be defined with the help of min and max property. The following example demonstrates to set the min and max on initializing the DateTimePicker.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling MVC for empty projects, visit

namespace EJ2CoreSampleBrowser.Controllers
    public partial class HomeController : Controller
        // GET: /<controller>/
        public IActionResult DateTimeRange()
            ViewBag.minDate= new DateTime(2019,11,22, 12,00,00);
            ViewBag.maxDate = new DateTime(2019, 11, 25, 05, 00, 00);
            return View();