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

Date in Grid subtracting 1 day

3 Answers 766 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 02 Jul 2014, 02:05 PM
Hi,

Sorry if I haven't searched enough to find a answer but can someone help me.

I put my application into production and all the dates seem to show the correct date minus 1 day. So instead of 1/6/2014 it shows 31/5/2014.

On local development PC the dates are correct and don't have this issue. All the functionality sorting filtering works but it just shows wrong date.

I use same browser  IE11  to view both sites.

I am using following to format date field in grid.

c.Bound(r => r.Effective_Status_Date).Width(150).Format("{0:dd/MM/yyyy}")

I tested the grid on the production server with a date field with no formatting and it shows the correct date if there is no formatting applied.

Production server is https:// but everything else seems to work except this date formatting.

Please let me know if there is a better way to get format  dd/mm/yyyy and not have this issue.

Thanks

Rob

3 Answers, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 03 Jul 2014, 01:36 PM
OK it looks like a time zone difference on the server is causing the issue.

server is GMT + 1. Users are in GMT

23/06/2014 00:00:00 is database value
22/06/2014 23:00:00 is value displayed in grid

Is there are global setting to make sure the date is displayed on client correctly?



0
Petur Subev
Telerik team
answered on 04 Jul 2014, 06:53 AM
Hello Robert,

The scenario is discussed several times on the forums and over the internet. The only applicable solution (that we can suggest) and explanation why this happens is shared within this code library project:

http://www.telerik.com/support/code-library/using-utc-time-on-both-client-and-server-sides

Kind Regards,
Petur Subev
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.

 
0
Robert
Top achievements
Rank 1
answered on 04 Jul 2014, 07:44 AM
I had seen this solution (from 2012) however this is a little disappointing I was hoping (in 2014) there was generic include file or reference that would check if it was a date field in the view and re-calculate it to UTC. My application was finished and I have over 300 (views and models) references to a date field in my application so I will need to update all of them with this code one at a time :( 
Oh well I better get started.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Petur Subev
Telerik team
Share this question
or