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

Date difference while inserting appointment in schedule control

Thread ID:





120541 Sep 24,2015 02:56 PM UTC Sep 25,2015 09:30 AM UTC ASP.NET MVC 1
Tags: Schedule
Asked On September 24, 2015 02:56 PM UTC


       I have used the below code to insert appointment

       if (Param.Action == "insert" || (Param.Action == "batch" && Param.Added != null))          // this block of code will execute while inserting the appointments

                var value = Param.Action == "insert" ? Param.Value : Param.Added[0];

                int intMax = db.DefaultSchedules.ToList().Count > 0 ? db.DefaultSchedules.ToList().Max(p => p.Id) : 1;

                DateTime startTime = Convert.ToDateTime(value.StartTime);

                DateTime endTime = Convert.ToDateTime(value.EndTime);

                DefaultSchedule appoint = new DefaultSchedule()


                    Id = intMax + 1,

                    //StartTime = startTime,

                    //EndTime = endTime, 

                    StartTime = startTime.ToUniversalTime(),

                    EndTime = endTime.ToUniversalTime(),

                    Subject = value.Subject,

                    Description = value.Description,

                    AllDay = value.AllDay,

                    Recurrence = value.Recurrence,

                    RecurrenceRule = value.RecurrenceRule





For example when i book an appointment for 24/9/2015 8.00 pm to 9.00 pm in the scheduler control, the appointment has been booked for that time.

But in db the  values inserted for starttime is 24/9/2015 9.00 pm and endtime is 10.00 pm and when i reload the page this booked appointment is not shown in 8.00 pm to 9.00 pm interval.

Instead  the appointment is shown in 2.30 pm to 3.30 pm interval.

could you suggest me what needs to be done to insert the actual timing in the db and get the actual timing when the scheduler is reloaded.

Saravanan .T

Karthigeyan Krishnamurthi [Syncfusion]
Replied On September 25, 2015 09:30 AM UTC

Hi Saravanan,

Thanks for contacting Syncfusion Support.

We have prepared the sample to overcome the reported issue with the time difference while inserting appointments in schedule control which can be downloaded from the following location:


We request you to add StartTimeZone and EndTimeZone fields in database with the time zone value. You can mention the system timezone or any other timezone value in StartTimeZone and EndTimeZone field and based on the timezone value, the StartTime and EndTime of the appointment will be calculated internally and gets rendered in the Schedule. For example, “UTC +05:30” to the StartTimeZone and EndTimeZone field in the database (you can pass different TimeZone value to each field).Therefore, we request you to add and pass the TimeZone value in database to load the database appointments with the given time. Please find the following code snippets that we have used in the above sample to meet your requirement.






        .TimeZone("UTC -05:00") // Here you can give your time zone value

        .CurrentDate(new DateTime(2015, 8, 24))



          .AppointmentSettings(fields => fields.Datasource(ds => ds.URL("/Home/GetData").CrudURL("/Home/Batch").Adaptor("UrlAdaptor"))




            .StartTimeZone("StartTimeZone")  // Kindly mention the StartTimeZone and EndTimeZone fields








if (param.action == "insert" || (param.action == "batch" && param.added != null))          // this block of code will execute while inserting the appointments


                var value = param.action == "insert" ? param.value : param.added[0];

                int intMax = db.Appointments.ToList().Count > 0 ? db.Appointments.ToList().Max(p => p.Id) : 1;

                DateTime startTime = Convert.ToDateTime(value.StartTime);

                DateTime endTime = Convert.ToDateTime(value.EndTime);

                var currentTimeZone = TimeZone.CurrentTimeZone;

                Appointment appoint = new Appointment()


                    Id = value.Id,

                    StartTime = startTime, // Kindly ignore ToUniversalTime() for both Start and EndTime as we have internally processed the appointment to render in the same time as created(even after appointments are reloaded) by using StartTimeZone and EndTimeZone fields

                    EndTime = endTime,



                    Subject = value.Subject,                  

                    Description = value.Description,                   

                    Recurrence = value.Recurrence,

                    RoomId = value.RoomId,

                    OwnerId = value.OwnerId,

                    CategoryId = value.CategoryId,

                    AllDay = value.AllDay,                  

                    RecurrenceRule = value.RecurrenceRule,                   





By default in schedule, appointments will render with the TimeZone “UTC +05:30”.  If the system TimeZone differs from the “UTC +05:30” or if different TimeZone is given on the sample side, it is mandatory to mention the “StartTimeZone and EndTimeZone” fields within the AppointmentSettings in order to save the appointments in the same time as created (even after appointments are reloaded). If the TimeZone value is given on sample side then the system TimeZone value will be neglected. For example “system TimeZone value/ sample side TimeZone value” is UTC +05:30 and if the “StarttimeZone and EndTimeZone value” is UTC +05:00 then the appointment will be rendered 30mins later from the time of appointment creation. The appointment will be rendered at 10.30 AM (say) if we create appointment at 10.00 AM.



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