This is a migrated thread and some comments may be shown as answers.

Issue with TimZone addition to time

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shreesh
Top achievements
Rank 1
Shreesh asked on 12 Feb 2015, 04:51 PM
I am using MVC5 wrappers for DateTIme in Kendo  Grid (ASP NET MVC wrappers)
My application works correctly when test it locally for date time, however when I deploy it on Azure website then issues starts. Timezone gets added to the datetime picker at time of display. I would like to keep it as UTC and not finding any proper solution.

I looked at following links but found none for MVC wrappers. I did not get what exactly to be done.
http://www.telerik.com/support/code-library/using-utc-time-on-both-client-and-server-sides
http://www.telerik.com/forums/timezone-issue
http://stackoverflow.com/questions/18718996/format-datetime-in-kendo-ui-grid-using-asp-net-mvc-wrapper

So as a fallback approach, I just converted date time to string as mydate.ToString("MM/dd/yyyy hh:mm tt");
However, I do not think this is right approach and feel there has to be better way rather than converting to string. Please let me know the correct solution and any sample code will help for using Datetime (Time is important for me) with Kendo Grid.

2 Answers, 1 is accepted

Sort by
0
Shreesh
Top achievements
Rank 1
answered on 13 Feb 2015, 04:30 PM
I could solve using js from one of the links. Its working properly for me.
However, I would like to know can it be done completely in c#?
0
Accepted
Alexander Popov
Telerik team
answered on 16 Feb 2015, 12:05 PM
Hello Shreesh,

This can hardly be done on the server-side, as the timezone offset is added on the client-side during the creation of the Date object. Additionally, the offset is different depending on the time-zone in which the client machine is, preventing you from properly calculating the dates on the server.

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Shreesh
Top achievements
Rank 1
Answers by
Shreesh
Top achievements
Rank 1
Alexander Popov
Telerik team
Share this question
or