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

How to stop Kendo MVC Grid 'messing' with timezones for datetime?

1 Answer 1281 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick Gilbert
Top achievements
Rank 1
Nick Gilbert asked on 03 May 2017, 04:33 PM

Hi,

We're displaying some data in an Kendo MVC Grid where the source data is stored in local time.  However when it gets printed in the Kendo grid, Kendo seems to assume the source data is in UTC and tries to convert it to the time zone of the web browser.

So in the database the time is: 2017-05-02 00:00:21.000

...but in the grid it displays as : 02/05/2017 01:00

How can we stop Kendo Grid from attempting to convert the data and just display it literally?

Thanks,

Nick

1 Answer, 1 is accepted

Sort by
0
Leon
Top achievements
Rank 1
answered on 04 May 2017, 08:11 PM

I bet you are using the default JSON serializer.. The default serializer will always convert the time on the server to client's timezone. 

Depending on what you are ultimately trying to archive. One of the simplest solution would be to convert your dates to a string before returning to the client and state the timezone is in UTC.. but then you'll lose all all the feature of having a datetime type.

See other posts for similar issues. http://www.telerik.com/forums/kendo-grid-automatically-converting-timezone 

Tags
Grid
Asked by
Nick Gilbert
Top achievements
Rank 1
Answers by
Leon
Top achievements
Rank 1
Share this question
or