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

Editing and Saving Data

following a post on this forum for Saving data edited in the Gantt, I copied and adapted the code, but the JSON Data provided buy the DatePicker in the Edit and Add Forms of the Gantt, the properties are in the forma like this:

Wed Oct 21 2015 00:00:00 GMT+0200 (ora legale Europa occidentale)

The problem is that the MVC Model Binder does not deserialize these dates correctly (the properties are Null because they are DateTime?

Could you provide a working sample to save data please?

Thanks in advance
    Andrea Perazzolo

5 Replies

DK Dinesh Kumar Nagarathinam Syncfusion Team October 30, 2015 05:21 PM UTC

Hi Andrea,

In Gantt control the start date and end date will be saved as date objects, and we can convert these date objects into any formats before saving it to the database. Can you please share us more details regarding to which format do you want to convert these date objects. Also can you please share us your sample you are trying to de-serialize the date objects , this will be helpful for us to provide you a better solution.

Please let us know if you need further assistance on this.


Dinesh kumar.N

PR Prasanth December 9, 2015 01:34 PM UTC

Hi Dinesh,

I have similar issue.

In  the ViewModel Task object I have the corresponding StartDate property of type Object (If I try to use DateTime type property then mapping doesn't seems to be working i.e Start Date from Gantt is not getting there).

And when I use the property of type object then mapping is working and the object .toString() value is something like

"Thu Dec 10 2015 00:00:00 GMT+1100 (AUS Eastern Daylight Time)"

The object type seems to be string array of length 1 ( System.String[])

Now how do I convert this into DateTime Object or can I just send this value to MS SQL column of type datetime or datetime2


DK Dinesh Kumar Nagarathinam Syncfusion Team December 10, 2015 01:21 PM UTC

Hi Prasanth,

Instead of converting the Global format of the date time object (ex: Thu Dec 10 2015 00:00:00 GMT+1100 (AUS Eastern Daylight Time)) to particular date time format, we can define “DateFormat” property of Gantt control as “MM/dd/yyyy hh:mm:ss tt”, and this format can be saved directly in the SQL table columns.

We have prepared a sample based on your requirement, find the sample from below location.

Sample: https://www.syncfusion.com/downloads/support/forum/120956/ze/MVCsampleSQL-985382851

Also could you please provide information about, from where you have passed the Global format date time object to data source?, so that we can provide a better solution regarding this query.

Please let us know, if you need further assistance on this.


Dinesh kumar.N

PR Prasanth December 13, 2015 05:38 AM UTC

Hi Dinesh,

Thanks for the reply.

I am using Visual Studio 15 community edition, Syncfusion and MVC 5.2.3.  I have tried to change the date format as per your suggestion but I am still getting the same issue and as a workaround I am removing the additional part "GMT+1100 (AUS Eastern Daylight Time)".  Basically the start date is being set from Gantt control's default mapping. 

I have attached the cshtml file along with this reply.  The view model class is copy pasted here.  If the details aren't enough I will package the project with controller, view and model.

public class ProjectTaskViewModel
        public ProjectTaskViewModel()
            Children = new List<ProjectTaskViewModel>();

        public int ID { get; set; }

        [Display(Name = "Title")]
        public string TaskName { get; set; }

        public int ProjectID { get; set; }

        public int ParentTaskID { get; set; }

        public IList<ProjectTaskViewModel> Children { get; set; }

        [Display(Name = "Start Date")]
        public Object StartDate { get; set; }

        [Display(Name = "Duration")]
        public int Duration { get; set; }

        public int PercentDone { get; set; }

        public IList<int> Resources { get; set; }

        public int TaskID { get; set; }

        public string Predecessor { get; set; }


Attachment: ProjectGantt_dd0dd924.zip

DK Dinesh Kumar Nagarathinam Syncfusion Team December 14, 2015 11:49 AM UTC

Hi Prasanthan,

Thanks for your provided information.

We are passing the value of date column with Globalize date format. If we want to save particular format in SQL table  then we have to convert it  before saving it to the SQL table.

Code Snippet:


<script type="text/javascript">

function ActionComplete(args) {


var data = args.data.item;

//data.StartDate is in Globala date format.

data.StartDate = Globalize.format(data.StartDate, "M/d/yyyy hh:mm:ss tt");




We have prepared a sample based on your requirement, find the sample from below location.

Sample: https://www.syncfusion.com/downloads/support/forum/120956/ze/Date_Format-1692846031


Dinesh kumar.N

Live Chat Icon For mobile
Up arrow icon