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

Date Difference btw Schedule Control and What was saved in Database

Goodday,

I am having issues reconciling the difference btw the date on my schedule control and the one saved in my Db.Though the Date rendered from the Db back to the schedule control is rendered correctly, I can't understand the almost + 6hrs difference in the StartTime and Endtime from the Schedule Control and what was saved in the Db even though my Timezone is UTC +01:00. 

I took my time to use fiddler to investigate and I saw the following.

Note: I used the EndTime (Time only) as Subject.

The EndTime sent from the schedule is EndTime=2017-07-23T08:00:00.000Z and what was return as result after saving to Schedule and Db was EndTime=2017-07-23T09:00:00+01:00 but what was saved in the Db (MSSQL) is 2017-07-23 13:15:00.000 and what was returned from my web query (MVC) is "2017-07-23T09:00:00". 

The actual expected EndTime 9:00 AM of 23rd of July. I don't understand why the DB time is saved as 15:00 (+6hrs). I need to understand what is the cause.

Also attached are images of the data for better understanding.

My schedule was created thus  :

 @(Html.EJ().Schedule("routeSchedule")

                          .Width("100%")

                          .Height("525px")

                         // .CellWidth("50px")

                          .CurrentDate(DateTime.Now)

                          //.Orientation(Orientation.Horizontal)

                          .Resources(res =>

                          {

                              res.Field("TerritoryId").Title("Territory").Name("Territories").AllowMultiple(true).ResourceSettings(fld => fld.Datasource(initialTerrittory)

                                  .Text("Text").Id("Id")).Add();

                              res.Field("RouteId").Title("Route").Name("Routes").AllowMultiple(true).ResourceSettings(flds => flds.Datasource(initialTerritoryRoutes)

                                  .Text("Text").Id("Id").GroupId("GroupId").Color("Color")).Add();

                          })

                          .Group(gr => gr.Resources(Group))

                          .ShowLocationField(true)

                          .CategorizeSettings(cat => cat.Enable(true))

                          //.PrioritySettings(pri => pri.Enable(true))

                         .ShowCurrentTimeIndicator(true)

                          .Views(view)

                          .CurrentView(CurrentView.Month)

                          .AppointmentSettings(fields => fields.Datasource(ds => ds.URL(@Url.Action("GetCompanyScheduledRoutes", "Route", new { companyid = Model.Id, routeid = firstroute, territoryid = firstterritory })).InsertURL(Url.Action("AddScheduledRoutes", "Route", new { companyid = Model.Id }))

                    .BatchURL(@Url.Action("Crud", "Route")).Adaptor(AdaptorType.UrlAdaptor))

                              .Id("Id")

                              .Subject("Subject")

                              .StartTime("StartTime")

                              .EndTime("EndTime")

                              .StartTimeZone("StartTimeZone")

                              .EndTimeZone("EndTimeZone")

                              .Description("Comments")

                              .AllDay("AllDay")

                              .Recurrence("Recurrence")

                              .RecurrenceRule("RecurrenceRule")

                              .RecurrenceId("RecurrenceId")

                              .RecurrenceExDate("RecurrenceExDate")

                              .Location("Location")

                              .ResourceFields("TerritoryId, RouteId"))

                              .ScheduleClientSideEvents(eve => eve.Navigation("OnNavigation").CellClick("OnCellClick").AppointmentWindowOpen("onAppointmentWindowOpen"))

                            /*.AppointmentTemplateId("#MyTemplate")*/)

Fiddler View


Schedule Control View


Web View



Database View



Attachment: DbDateDifference_de72d5a9.zip

4 Replies

CH Charles July 23, 2017 05:36 PM UTC

Note: Its is an MSSQL (2008) Database 


SE Sellakumar Syncfusion Team July 24, 2017 01:05 PM UTC

Hi Charles, 
 
Thanks for contacting Syncfusion support. 
 
The timezone conversion for StartTime and EndTime has been occurs based on the zero UTC value. So the time difference has been reduced before going to the database. The object has been retrieved from database to render the appointment, the reduced time difference has been added and displayed in the scheduler. To render the appointment as same as the time given in data base (without considering timezone difference) set ApplyTimeOffset to false within AppointmentSettings.  Kindly check this case at you end and revert us, if you need any further assistance on this. 
 
Regards, 
Sellakumar K


CH Charles July 24, 2017 02:31 PM UTC

Thanks alot, sorted it out. Its an issue with my app, somewhere @the initialization of my app, a wrong time-zone was set as default.



KK Karthigeyan Krishnamurthi Syncfusion Team July 25, 2017 05:24 AM UTC

Hi Charles,  
 
We are happy to hear that your issue has been resolved.  
 
Regards, 
Karthigeyan 


Loader.
Live Chat Icon For mobile
Up arrow icon