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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting Value date incorrectly

Thread ID:





118775 Apr 8,2015 08:36 PM UTC Apr 14,2015 05:19 AM UTC ASP.NET MVC 3
Tags: DatePicker
Rob ONeill
Asked On April 8, 2015 08:36 PM UTC

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.

Kasithangam C [Syncfusion]
Replied On 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.



Rob ONeill
Replied On 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. 

Kasithangam C [Syncfusion]
Replied On 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.




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon