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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateTime time zone America/Mexico_City

Thread ID:

Created:

Updated:

Platform:

Replies:

132322 Aug 26,2017 03:23 AM UTC Aug 28,2017 01:13 PM UTC ASP.NET MVC 1
loading
Tags: Grid
Héctor Reyes
Asked On August 26, 2017 03:23 AM UTC

I have a grid that display an date, on database and controller, the dates correct, by example: 2017-08-25 21:34:22.000

But, in the Grid display other hour 2017-08-25 16:34:22.000, -5 hours  that are the difference in the time zone America/Mexico_City

The code that use for display the date is:

col.Field("FechaInicial").HeaderText("Fecha Inicial").Format("{0:dd/MM/yyyy hh:mm:ss tt}").TextAlign(TextAlign.Right).Add();

The aplication is hosted in Azure in West of the USA and the users are in Mexico

Thavasianand Sankaranarayanan [Syncfusion]
Replied On August 28, 2017 01:13 PM UTC

Hi Héctor, 

Thanks for contacting Syncfusion support. 

We suspect that you are facing server and client time zone difference issue. DataTime will be parsed in the client-end after retrieved from the server-end. While parsing the DateTime, the conversion will be based on the client time zone. To overcome this problem, you can set the timezone offset from UTC in hours using the ej.serverTimezoneOffset which has been explained in the following Help Document. 


The date-time request on the controller is depend on the server time zone.  

Suppose, application has been hosted in EST time zone and client may be in IST, GMT etc. in that case, date will differ from database. If the client and server has different timezone, storing date-time on server using server timezone which is cause of the issue. 

Refer the below code example to resolve the issue. 


<script type="text/javascript"> 
 
        var serverTimeZoneDiff = -5.0   // if your server is in EST time zone (UTC -5.0) (in hours) 
 
        var clientSideTimeZoneDiff = new Date().getTimezoneOffset() / 60; // get client time zone difference and convert it to hours; 
 
        ej.serverTimezoneOffset = serverTimeZoneDiff + clientSideTimeZoneDiff; 
         
</script> 


If you are still facing any problem, please share the following information to analyze the problem at our end.  

  1. Code example of the Grid
  2. Confirm the version of Essential Studio (14.4.0.15)
  3. If possible, share the hosted sample link.

Regards, 
Thavasianand S. 


CONFIRMATION

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.

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

;