We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Setting Value date incorrectly

I am trying to set the DatePicker Value through a ViewModel binding but the date is getting set incorrectly. If the date is say 01/04/2015 (1st April 2015) it is getting rendered as 4th January 2015. I can see that the datetime that gets passed through to the control is correct but the resulting date in the control has been rendered incorrectly. Can you tell how to render the date correctly. See my code i using below.

@model Portal.Web.Areas.Reporting.Controllers.DateSettings
    ViewBag.Title = "Reporting";
    Layout = "~/Views/Shared/_Layout.cshtml";

<h2>Reporting View</h2>

    public class HomeController : Controller
        // GET: Reporting/Home
        public ActionResult Index()
            var dateSettings = new DateSettings();
            dateSettings.StartDate = DateTime.Now.AddDays(-7);
            return View(dateSettings);

    public class DateSettings
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }

Cheers .... Rob.

3 Replies

KC Kasithangam C Syncfusion Team April 9, 2015 11:41 AM UTC

Hi Rob,

We have analyzed your query with the provided code.We are unable to reproduce the specified issue “date value is setting incorrectly”.We would like to let you know that,our date picker control default date format is mm/dd/yyyy so that the date displays as “4/1/2015”.While working with your code the datetime is passed in controller as “4/1/2015” (1st April).That is the date value displays in datepicker control rendering.If you want to change the date format displays as “01/04/2015”,we have a property dateformat, By setting the dateformat as “dd/MM/yyyy”, we can displays the date format as “01/04/2015”(1st April,2015).Please find the code for setting the dateformat,




We have prepared the sample for datepicker control based on your code information and please find the sample under the following location,

Sample: Sample

Could you please check with the above sample? If still you face the same problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you.

Please let us know if you have further queries.



RO Rob ONeill April 10, 2015 01:29 PM UTC

Hi Kasithangam,
I have downloaded your sample, and I get the same results as mine. If in the controller I pass in April 1st it gets rendered as January 4th. I think this is down to my computer's date / time settings which are en-GB (UK). The DateTime I am passing though the controller is 1st April and even on a break point on the cshtml page I can see the Model.StartDate is 1st April. I am wondering how your control takes this date to convert it. I think for you to see this you need to change your computer settings to UK if possible.
We have got around this by using Model.StartDate.ToLongDateString() but there is definitely a bug there as running your sample we still get the same error.

Cheers ... Rob. 

KC Kasithangam C Syncfusion Team April 14, 2015 05:19 AM UTC

Hi Rob,

We are able to reproduce the issue(“Datepicker value doesn’t render properly while using en-GB”).A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates.


Please let us know if you have further concern.



Live Chat Icon For mobile
Up arrow icon